Skip to main content
gamedev.net
🔒 Locked

Need Visual Basic Database help, Please?

Started by ilcapo10 7 replies 1k views
Original Post
ilcapo10
ilcapo10
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]
ilcapo10
ilcapo10
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]
ilcapo10
ilcapo10
I changed the topic title, hopefully someone can help me, cause I'm stuck
evolutional
evolutional
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.
ilcapo10
ilcapo10
Hi evolutional, thanks for your help, I can now see all the surnames, but when I click on them it stays on the record where I was. How can I do for example if I click in the De Niro Surname to go to his record. Thanks Again
ilcapo10
ilcapo10
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
evolutional
evolutional
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).
ilcapo10
ilcapo10
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...)
smr
smr
Let's see your query

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.