N
Nick T
Hi,
I have the following code in the 'on click' event of a command button on a
form. Also on the form are text boxes. I want to type a 'post code' into my
relevant text box, click my 'find' button, and the associated info (which is
in my table) to be put into the other relevant text boxes.
This is my code:
Private Sub Command9_Click()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Addresses", dbOpenDynaset)
With rst
.FindFirst "[PostalCode] = " & Me.PostalCode
If .NoMatch Then
MsgBox "Post Code " & Me.PostalCode & " Not Found in Client list"
Else
Me.FirstName = !FirstName
Me.LastName = !LastName
Me.CustomerID = !CustomerID
End If
.Close
End With
Set rst = Nothing
End Sub
However, i have a Syntax error with the following in the above code.
..FindFirst "[PostalCode] = " & Me.PostalCode
Any suggestions??
Many thanks
I have the following code in the 'on click' event of a command button on a
form. Also on the form are text boxes. I want to type a 'post code' into my
relevant text box, click my 'find' button, and the associated info (which is
in my table) to be put into the other relevant text boxes.
This is my code:
Private Sub Command9_Click()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Addresses", dbOpenDynaset)
With rst
.FindFirst "[PostalCode] = " & Me.PostalCode
If .NoMatch Then
MsgBox "Post Code " & Me.PostalCode & " Not Found in Client list"
Else
Me.FirstName = !FirstName
Me.LastName = !LastName
Me.CustomerID = !CustomerID
End If
.Close
End With
Set rst = Nothing
End Sub
However, i have a Syntax error with the following in the above code.
..FindFirst "[PostalCode] = " & Me.PostalCode
Any suggestions??
Many thanks