Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Fill Name & Address

Status
Not open for further replies.

MickJ

Programmer
Feb 20, 2002
21
US
I am trying to Auto Fill Address, City, State And Zip fields on a VB form that reads an Access DB. Choosing a name from a combo or list box would automatically fill in the other fields. (that's my theory anyway). Any suggestions would be helpfull, writing the code for me would be better:) Thanks.
 
On the Click event for the combo box, move to the record that matches and fill in the remainder of the forms.

If your using ADO, you first fill the Combo box on form load with the items from the DB.
[tt]
With rs
Do until .EOF
Combo1.AddItem !field_for_combo
Loop
End With
[tt]
Then when the combo is clicked.
[tt]
Private Sub Combo1_Click()
With rs
.Filter = "field_for_combo=" & Combo1.Text
txtLastName = !LastName
txtFirstName = !FirstName
txtAddress = !Address
.Filter = ""
End With
End Sub
[tt]
Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top