Hi
im tying to create a search function that will find all the details of a customer when i enter there account number. So far i can return the name of the customer when i enter in a valid account number but am unsure how to solve the problem when an invalid account is entered. Also this only returns one field at a time- is there a more efficient way i could assign the customers records to the corresponding text boxes,for example the code below will reurun the name and assign it to the name text box but would i have to do multiple dlookups to display the forename,job title and occupation details in there relevant text boxes
I am currently using:
Private Sub cmdSearch_Click()
Dim search As String
If IsNull(Me.txtAccNum) Or Me.txtAccNum = "" Then
MsgBox "You must enter an Account Number.", vbOKOnly, "Required Data"
Me.txtAccNum.SetFocus
'Exit Sub
Else
txtCustomerName = DLookup("strName", "tblCustomers", "intAccNum=txtAccNum")
End If
End Sub
any directing would be great thanks
im tying to create a search function that will find all the details of a customer when i enter there account number. So far i can return the name of the customer when i enter in a valid account number but am unsure how to solve the problem when an invalid account is entered. Also this only returns one field at a time- is there a more efficient way i could assign the customers records to the corresponding text boxes,for example the code below will reurun the name and assign it to the name text box but would i have to do multiple dlookups to display the forename,job title and occupation details in there relevant text boxes

I am currently using:
Private Sub cmdSearch_Click()
Dim search As String
If IsNull(Me.txtAccNum) Or Me.txtAccNum = "" Then
MsgBox "You must enter an Account Number.", vbOKOnly, "Required Data"
Me.txtAccNum.SetFocus
'Exit Sub
Else
txtCustomerName = DLookup("strName", "tblCustomers", "intAccNum=txtAccNum")
End If
End Sub
any directing would be great thanks