Retriving Data from a table based pn a partial value...HELP

sam77755

Registered User.
Local time
Today, 05:20
Joined
Dec 7, 2004
Messages
23
HI I am Looking for some help here...
1- I have a table that has a Postal code field.
2- a Query getting data from the table to a form.
3- a textbox in the form that the Onclick event is set to run the query based on the value I enter in an input box triggerd by the on click event code below.

Private Sub BDM_Click()
Dim varPostal As Variant

varPostal = InputBox("Please Enter Postal Code")
txtPostal = varPostal
DoCmd.OpenQuery "QryAvgIncome"

End Sub

Of course the qry is getting the inputbox value from the text box txtPostal

4- Canadian postal codes are always in this format L1L 1L1.
5- my problem is I am trying to enter a partial entry in the input box (i.e. L1L) and ask the query to return all matching results. I tried using the Like* in the query but again it didnt work, I belive the reason is that the field is built based on the input from the form.

Guys anyone knows how to overcome this problem?

thank you all

P.S. I am using Access 2003
 
Like is the correct operand but don't forget the wild card.

Where Postal Like Forms!YourForm!txtPostal & "*";
 
PAT thank you very much....
IT WORKED....

I was missing the string quotes on the wild card.
 

Users who are viewing this thread

Back
Top Bottom