?
Solved

compile error. expected expression.

Posted on 2011-10-11
6
Medium Priority
?
572 Views
Last Modified: 2012-06-27
I get a compile error. expected expression.

sqlCode = "SELECT * FROM imail_tblIMail where [ClientID] =  & strClient & " And [EnvelopeImageName]   Like  '" & strDoc & "*'"

surely it's a single or double quote I'm missing but am stuck. :(

Any ideas?
0
Comment
Question by:Shawn
  • 2
  • 2
  • 2
6 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36953001
Try this:

sqlCode = "SELECT * FROM imail_tblIMail where [ClientID] = "  & strClient & " And [EnvelopeImageName]   Like  '" & strDoc & "*'"



0
 
LVL 61

Expert Comment

by:mbizup
ID: 36953004
The above assumes ClientiD is Numeric.

If it is TEXT, use this:

sqlCode = "SELECT * FROM imail_tblIMail where [ClientID] = '" & strClient & "' And [EnvelopeImageName]   Like  '" & strDoc & "*'"

0
 
LVL 75
ID: 36953221
In case that doesn't work, try this:

sqlCode = "SELECT * FROM imail_tblIMail where [ClientID] = " & Chr(34) & strClient & Chr(34) & " And [EnvelopeImageName] Like " & Chr(34) & strDoc & Chr(34) & " * """

mx
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75
ID: 36953226
opps ... typo:

sqlCode = "SELECT * FROM imail_tblIMail where [ClientID] = " & Chr(34) & strClient & Chr(34) & " And [EnvelopeImageName] Like " & Chr(34) & strDoc & Chr(34) & "*"


mx
0
 
LVL 1

Author Closing Comment

by:Shawn
ID: 36953440
that did the trick. thx
0
 
LVL 1

Author Comment

by:Shawn
ID: 36953442
thanks for the alternative mx :)

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question