criteria

ianatkins

Registered User.
Local time
Today, 20:59
Joined
Oct 25, 2002
Messages
16
Ok ive got a criteria on a surname which is based on the value from an unbound text box.

Currently in the query the criteria is:
Like "[forms]![frmalpha]![letter].[text]*"

Which would return all fields starting with the value of letter.

This returns nothing. If I close the form the query doent prompt for the value.

If I just put [forms]![frmalpha]![letter].[text] then it will return records, and if i put a* it will return records, but combining the two doesnt work!

Any help would be most welcome, is it a syntax error.

Thanks
Ian.
 
ianatkins said:
Currently in the query the criteria is:
Like "[forms]![frmalpha]![letter].[text]*"

Take out the quotation marks...
 
it throws an invalid syntax message without the quotes.

By the way im using access 97. Is their any other way of selecting records by thier first letters?
 
Add a hidden unbound textbox to the form, add the following code to the original textbox
Private Sub txtEntry_Change()
On Error GoTo Err_txtEntry_Change


Me!txtSearchExpression = Me!txtEntry.Text & "*"
lstFound.Requery

Exit_txtEntry_Change:
Exit Sub

Err_txtEntry_Change:
MsgBox Err.Description
Resume Exit_txtEntry_Change

End Sub

change the query criteria to
Like [forms]![frmalpha]![ltxtSearchExpression]
 
The problem was the reference to the .text property.

Like [forms]![frmalpha]![letter] & "*"
 

Users who are viewing this thread

Back
Top Bottom