Jim,
Debug.Print is your best friend (other than this group) when you have VBA issues.
strSQL1 = "SELECT SupervisorTableWithEmail.[Asu Email Addr] FROM SupervisorTableWithEmail WHERE SupervisorTableWithEmail.EmailReportsTo = True AND SupervisorTableWithEmail.[Person Nm]='" & SupervisorName & "'"
- You have misspelled a table or field name
- You have a reference to a control on a form in your query
Sent: Wednesday, October 25, 2017 1:38 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] VBA Select statement Error
Hello all,
I needed to change a strSQL to accommodate a check box to email reports to. The user wanted to choose from a table those supervisors that should get an email with a report.
The original line states the following
strSQL1 = "SELECT [R&D-CURRENTEMPLOYEES].[Asu Email Addr] FROM [R&D-CURRENTEMPLOYEES] WHERE [R&D-CURRENTEMPLOYEES].[Person Nm]='" & SupervisorName & "'"
then I changed it to a new table
strSQL1 = "SELECT SupervisorTableWithEmail.[Asu Email Addr] FROM SupervisorTableWithEmail WHERE SupervisorTableWithEmail.EmailReportsTo = True AND SupervisorTableWithEmail.[Person Nm]='" & SupervisorName & "'"
But I am getting the following error
Run-Time error '3061'
Too Few parameters. Expected 2.
SupevisorName is the value of a union query which produces the Supervisor Name.
What is the 2 parameters that I need?
Thank You
Jim Wagner
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar