🔒 Locked
Need Visual Basic Database help, Please?
Advertisement
Original Post
Hi, I'm new to this forum, I just registered, and thanks to this forum I found help on conecting to access databases from visual basic 6. Till now everything work perfectly, I can conect to the database, view data, modify data, delete,etc. But the thing is that to browse the database I'm using next record and previous record command butons. It works just fine but that is because there are only 10 example records I just made for testing, but the editor is for editing a game database(movie game) which is going to have hundreds of actors, directors, producers, etc. So the next and previous butons are not good enough, so I decided to add a combo box to browse through the database and see the surnames in a much easier way. The thing is I have no clue how to do this, can anyone please help me on this? Also I want the player to be able to add images from the editor to the database, is this posible? Thanks in advance and sorry for my lousy english [Edited by - ilcapo10 on July 19, 2006 9:33:10 AM]
well I found a new control which I think is the correct one, instead of the combo box I found the data combo, I link the datasource to the ado and the field to the surnames, but the only surname I get to see in the data combo is the first one, and when I click in the data combo a list all blank appears, no surnames at all, I'm at a loss.
As for images I have no clue, though I'm looking
[Edited by - ilcapo10 on July 18, 2006 3:25:39 PM]
As for images I have no clue, though I'm looking
[Edited by - ilcapo10 on July 18, 2006 3:25:39 PM]
You could probably do this by binding the control to an ADODB recordset. Look at the VB help for the DataSource/RowSource property in the ComboBox object; I'm sure google will turn up a few answers too.
sorry to bother again ;), but in the data combo properties I can't find sorted(which you can find in combo box to sort the results in alphabetical order) does this means that the data can't be seen in alphabetical order with the data combo? Sorry, I know some of these questions may seem really stupid, but I'm pretty new to vb and really new to the databases part
You need to wire up your query to sort the data (eg: add "order by Surname" to the end). To make it jump to the record, you need to hook the OnChange (I think) event and use it to call the code that updates your form (by retreiving the surname/id record from the ComboBox current selection).
Thanks for the reply.
Well I tried, but I can't make it work
Private Sub DataCombo1_Change()
adoActors.Recordset.Fields("Surname") = DataCombo1.BoundText
End Sub
I tried to use that to change it but no luck, and when I try to update it gives me an error.
Private Sub DataCombo1_Change()
adoActors.Recordset.Fields("Surname") = DataCombo1.BoundText
adoActors.Recordset.Update
End Sub
I'm sure its because I can't get correctly the info of the data combo, but I tried almost everything(ended with boundtext). But I can't even match the surname field with the selected one in the data combo :/
This problem and adding the image are the only things mising from having the editor complete and its taking 20 times more than all the rest of the editor :S . I'm tired now, Gonna get some sleep and see if tomorrow I have better luck (though I know luck has nothing to do with it...)
Well I tried, but I can't make it work
Private Sub DataCombo1_Change()
adoActors.Recordset.Fields("Surname") = DataCombo1.BoundText
End Sub
I tried to use that to change it but no luck, and when I try to update it gives me an error.
Private Sub DataCombo1_Change()
adoActors.Recordset.Fields("Surname") = DataCombo1.BoundText
adoActors.Recordset.Update
End Sub
I'm sure its because I can't get correctly the info of the data combo, but I tried almost everything(ended with boundtext). But I can't even match the surname field with the selected one in the data combo :/
This problem and adding the image are the only things mising from having the editor complete and its taking 20 times more than all the rest of the editor :S . I'm tired now, Gonna get some sleep and see if tomorrow I have better luck (though I know luck has nothing to do with it...)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement