Syntax Error

Mitsuki

Registered User.
Local time
Today, 12:24
Joined
May 7, 2006
Messages
11
Hi

Can someone please tell me what is wrong with this statement

Code:
SELECT WHSender.Sender, WHSender.Phone  FROM WHSender WHERE (((WHSender.SenderID) Like forms!GeneralForm!ShipmentData.SenderName));
 
It looks like you are filtering the primary key (senderID) with text criteria (SenderName).
 
I have 2 tables
WHSender (Sender, Phone, SenderID) and WHSend (SenderID, Sender)

In the form I have a combo box with sender's names and I have a list box called Sender Phone .. Whenever the user choose and sender name I want the sender phone to change regarding the sender name ...

Does this make sense ... ???

Maybe am doing it wrong .. can someone please help me
 
"SELECT WHSender.Sender, WHSender.Phone FROM WHSender WHERE (((WHSender.SenderID) Like " & forms!GeneralForm!ShipmentData.SenderName & "));"

You have to separate the variable from the select statement so it can be evaluated properly.

Larry
 
Mitsuki,

Like has to have an "*"

"SELECT Sender, Phone FROM WHSender WHERE SenderID Like '*" & forms!GeneralForm!ShipmentData!SenderName & "*';"

Wayne
 
WayneRyan said:
Mitsuki,

Like has to have an "*"

"SELECT Sender, Phone FROM WHSender WHERE SenderID Like '*" & forms!GeneralForm!ShipmentData!SenderName & "*';"

Wayne
I have used LIKE with/without a wildcard and it worked for me.
For instance, a combo box on a form with definitive selections for query criteria, and a "*" added to the rowsource in case you want to pass all records...
In the query, I use LIKE Forms!MyForm!cboCriteria. If you select the asterisk, you get everything...if you select a criteria, you just get that.
 

Users who are viewing this thread

Back
Top Bottom