PDA

Click to See Complete Forum and Search --> : DBCombo_Change


JureVI
Aug 30th, 1999, 10:10 PM
I'm very new in database development and I don't know, how to do this:
In my app I use a DBCombo, a TextBox, Data control and DBGrid. When I change the selection in DBGrid, the contents of DBCombo and TextBox change. How can I do this backward - that means when I'll change the item in DBCombo, the selection in DBGrid will change and the TextBox will change its contents? I hope, you understand.
Thanks.

Jure

pmeredith
Aug 31st, 1999, 12:22 AM
I belive in the Dbcombo change event you need to requery the data control like this:

Private Sub DbCombo_Change()

Dim strRecord As String
strRecord = dbcombo.Text

Data1.RecordSource = "Select fieldname from tablename WHERE record Like '" & strRecord & "*'"
dtaFind.Refresh
DBGrid1.ReBind

End Sub

That's how I figured it out.

Hope this helps

pmeredith

JureVI
Aug 31st, 1999, 09:31 PM
Thank you for your answer, but I don't understand it. I tried to paste your code into my code, but it doesn't work. Error occours at line Data1.RecordSource=...

Skrmetti
Aug 31st, 1999, 09:53 PM
You're going to need to translate the names of objects in the code to the names of the objects your using. If your data control isn't called Data1, you need to replace Data1 with the name of your data control. Further, depending on the type of data control you are using, the syntax of the code will be somewhat different. Are you using an ADO control, a DAO control, or an RDO control? Or are you using data objects without controls? If you'd like to post the code you have so far I'll check it out and see if I can't come up with an answer for you.

HTH,
Jonathan

JureVI
Aug 31st, 1999, 10:14 PM
Can I send you my whole project?

Skrmetti
Aug 31st, 1999, 10:54 PM
Sure. Send it to jskrmett@protopower.com. I'll give it a look.

-Jonathan