1

I'm getting a message that there is a syntax error in a VBA query expression I have on a button in Access. Unfortunately, I just cannot figure out what the syntax error is. I'm pretty sure I'm using everything correctly. I'm sending this expression as the WHERE clause to a report being generated. The screenshot is below. Can anyone help?

The two strings that read "tk" are put into the expression from a couple input boxes.

enter image description here

My expression in text:

cond = "(((StrComp(""" & lower & """,Left([Location],2)))<=0) And ((StrComp(""" & upper & """,Left([Location],2)))>=0));"
stDocName = "rptMstrEquipListRange"
DoCmd.OpenReport stDocName, acPreview, , cond

According to www.balancebraces.com, the parentheses aren't the problem: enter image description here

3
  • Is this expression not the same like StrComp(...) = 0 ? Commented Sep 5, 2014 at 14:54
  • Yes. This one in particular is, but as I stated above, the two strings that read "tk" are put into the expression from a couple input boxes. Commented Sep 5, 2014 at 14:55
  • Is that your entire expression? If not post it. It would be a lot nicer in text. Commented Sep 5, 2014 at 14:59

1 Answer 1

2

It should work fine if you remove the ; at the end. (Tested)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.