-
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
-
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
-
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=...
-
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
-
Can I send you my whole project?
-
Sure. Send it to [email protected]. I'll give it a look.
-Jonathan