P
plh
Hello Everyone,
MS Office Access 2003 SP2
I have a form in the continuous form type of view. On the form header is a text
box for users to filter the field 'COP' accordingly. COP is the customer order
number. So for example, if they type in "1" <Enter> they should see only the
records that begin with 1, if they add "2" <Enter> so that it says "12", they
should see only those records that begin with "12", etc. Here is my code:
Private Sub txtFilter_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT * FROM tblCustOrds WHERE COP LIKE '" & Me.txtFilter.Value &
"%'"
Me.RecordSource = strSQL
End Sub
I can look in the property window at the form's RecordSource property and see
that it is now (with txtFilter containing a "1"):
SELECT * FROM tblCustOrds WHERE COP LIKE '1%'
(That is a direct Copy/Paste)
The problem is that the form is excluding everything, no matter what is in the
text box. There are plenty of COPs that begin with "1"
What am I doing wrong???
Thanx,
-plh
MS Office Access 2003 SP2
I have a form in the continuous form type of view. On the form header is a text
box for users to filter the field 'COP' accordingly. COP is the customer order
number. So for example, if they type in "1" <Enter> they should see only the
records that begin with 1, if they add "2" <Enter> so that it says "12", they
should see only those records that begin with "12", etc. Here is my code:
Private Sub txtFilter_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT * FROM tblCustOrds WHERE COP LIKE '" & Me.txtFilter.Value &
"%'"
Me.RecordSource = strSQL
End Sub
I can look in the property window at the form's RecordSource property and see
that it is now (with txtFilter containing a "1"):
SELECT * FROM tblCustOrds WHERE COP LIKE '1%'
(That is a direct Copy/Paste)
The problem is that the form is excluding everything, no matter what is in the
text box. There are plenty of COPs that begin with "1"
What am I doing wrong???
Thanx,
-plh