Zacharyjuniorman
New member
- Local time
- Today, 07:53
- Joined
- May 15, 2001
- Messages
- 7
Here is my problem. I have a customer table that includes - customer id(AutoNumber), customer name, customer address, customer city, customer state, customer zip, customer phone. I want to be able select the customer name from a drop down box and have the remaining data fill in auto. I read other posts tried the code and it does not work. Please forgive me I am new at vb.
Here is the event I have on the drop down box that gets the error.Private Sub Combo17_AfterUpdate()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblCustomers")
rst.Index = "CustomerName"
rst.Seek "=", Me!Combo17
If rst.NoMatch Then
MsgBox "Customer not found!"
Else
Me!CustomerName = rst![CustomerName]
Me!CustomerAddress = rst![CustomerAddress]
Me!CustomerCity = rst![CustomerCity]
Me!CustomerState = rst![CustomerState]
Me!CustomerPhone = rst![CustomerPhone]
End If
End Sub
Private Sub Combo17_BeforeUpdate(Cancel As Integer)
End Sub
Here is the event I have on the drop down box that gets the error.Private Sub Combo17_AfterUpdate()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblCustomers")
rst.Index = "CustomerName"
rst.Seek "=", Me!Combo17
If rst.NoMatch Then
MsgBox "Customer not found!"
Else
Me!CustomerName = rst![CustomerName]
Me!CustomerAddress = rst![CustomerAddress]
Me!CustomerCity = rst![CustomerCity]
Me!CustomerState = rst![CustomerState]
Me!CustomerPhone = rst![CustomerPhone]
End If
End Sub
Private Sub Combo17_BeforeUpdate(Cancel As Integer)
End Sub