Click to See Complete Forum and Search --> : Help with code to fill text boxes


aussiecyclone
March 30th, 2001, 09:12 PM
Hi,

I have an address database with the Field ID as the primary key, I have managed to load by code a combo with surnames.

What I want to do is load textboxes, such as address and suburb from the DB which correspond to the name when selected in the combo.

Any sample of code to do this is appreciated.

Regards,

Alan.

shree
March 30th, 2001, 10:45 PM
Use the FindFirst method with the ComboBox text in the criterion to lacate it in the recordset. Then use the Fields method to load the appropriate field into a textbox.

Robert Moy
March 31st, 2001, 12:32 AM
Hello:

You can try this code if you using ADO to get your DB NAME is a column number

Private Sub Command2_Click()
Adodc1.Recordset.Find "NAME=" & "'" & Combo1.Text & "'"

End Sub

Private Sub Command3_Click()
Adodc1.Refresh
End Sub

I hope this answer your question. If you need more help, please reply

Robert Moy
March 31st, 2001, 12:37 AM
Hello:

I forgot to mention to you. To set textboxes, you set datasource to the ado or dao object and then set datafield to your field.

Good Luck