Hi guys, I have a form where you are required to enter a clients details, what I would like to do is when the user types in the clients account number (The unique identifier for the account) it will fill in all the other fields such as; client name, address line 1, address line 2, address line 3 etc etc I have tried a combo box but I don't want a drop down box I want to be able to type and have it appear when I click out of the box
I have tried this in the control source;
where column 5 is address line 1
- Txt_ClientAccountNumber being the name of the unbound TextBox control where the user types in the clients account number,
- ClientAccountNumber being the name of the Field that holds the client account number (from the table or query),
- ClientAccountNumber being numeric,
- the Form being bound,
you can use:
Private Sub Txt_ClientAccountNumber_AfterUpdate
Dim rst as DAO.Database
Set rst = Me.RecordsetClone
.FindFirst "ClientAccountNumber = " & Me.Txt_ClientAccountNumber.Value
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Msgbox "There is no client whith the account number " & Me.Txt_ClientAccountNumber.Value, vbInformation, "Not found"
Set rst = Nothing
If ClientAccountNumber is defined as Text, replace:
I have removed the spaces from the objects, however when I type an account number in the field it comes with with an error message stating
Method or Data member not found"
Then highlights ".FindFirst" in the VBA editor
I have done that however when I type in an account number it comes up with the error message, no matter what account number I use the account number field is ClientAccountNumber in both tables it appears in as a primary key and a foreign key
1. Is the name of the field ClientAccountNumber?
2. What does Me.Txt_ClientAccountNumber.Value returns (set a breakpoint on the line and use the Quick Watch feature [Ctrl+F9] when the code stops executing)?