G
Guest
Hi, I have a form, user needs to select "Carrier" from a drop down list,
later when they hit a button, an email will be sent to the carrier they
choose with other content in the form. I have a table for carrier contact
information named "carrier", it has an "Email" field for email, and a
"Carrier" field for carrier name. I wrote these codes for the on_click event,
but could not get it to work
Dim RParty As String
Dim StrSQL As String
RParty = Me!Carrier
StrSQL = "SELECT Email " & _
"FROM Carrier " & _
"WHERE Carrier = '" & RParty & "'"
DoCmd.RunSQL StrSQL
I use Msgbox to see the SQL string, and it looks fine, but RunSQL keeps
saying error 2342, A RunSQL action requires an argument consisting of a SQL
statement. I even tried using a real carrier name instead of a variable in
the query, but still get the error message, it really drives me crazy as the
query is so simple. please help.
later when they hit a button, an email will be sent to the carrier they
choose with other content in the form. I have a table for carrier contact
information named "carrier", it has an "Email" field for email, and a
"Carrier" field for carrier name. I wrote these codes for the on_click event,
but could not get it to work
Dim RParty As String
Dim StrSQL As String
RParty = Me!Carrier
StrSQL = "SELECT Email " & _
"FROM Carrier " & _
"WHERE Carrier = '" & RParty & "'"
DoCmd.RunSQL StrSQL
I use Msgbox to see the SQL string, and it looks fine, but RunSQL keeps
saying error 2342, A RunSQL action requires an argument consisting of a SQL
statement. I even tried using a real carrier name instead of a variable in
the query, but still get the error message, it really drives me crazy as the
query is so simple. please help.