Solved

Why an I getting a "Syntax" error with the where condition?

Posted on 2014-11-26
9
116 Views
Last Modified: 2015-01-31
I have tried may combinations of the code below, but still get syntax error?

BAD CODE:
SS_OpenForm("Human_P_T_frm"), ([Event_Description]=" & "'" & [Event_Description] & "'")

Any help is greatly appreciated.
ERROR-MESSAGE-1.jpg
ERROR-MESSAGE-2.jpg
Works-Fine-1.jpg
0
Comment
Question by:cssc1
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 125 total points
ID: 40467813
AFAICT, ...you can try it something like this:
Docmd.OpenForm "Human_P_T_frm",,,[Event_Description]=" & "'" & [Event_Description] & "'"
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 125 total points
ID: 40467833
Is SS_OpenForm a custom function?  (it would help to see the function declaration).

That said, it looks like your criteria is missing an opening quote, so try this perhaps:


SS_OpenForm  "Human_P_T_frm",  "[Event_Description]=" & "'" & [Event_Description] & "'" 

Open in new window

0
 
LVL 12

Assisted Solution

by:FarWest
FarWest earned 125 total points
ID: 40467838
I learned a good practice (I think) is to use char(34) instead of " when ever it should placed inside another quote
you will always know what " will be inside your string :)
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:cssc1
ID: 40467956
mbizup (SMIB),
   Sorry, but see attached error message with your example.
Error-3.jpg
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 125 total points
ID: 40468441
It should probably read:

SS_OpenForm("Human_P_T_frm", "[Event_Description] = '" & [Event_Description] & "'")

/gustav
0
 

Author Comment

by:cssc1
ID: 40468861
Gustav Brock,
  Please see error.
Thanks and can you think of any other any other options based on what the error says?
ERROR---3.jpg
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40468873
Without knowing the internals of your custom SS_OpenForm function I'm afraid we can't solve this.

/gustav
0
 
LVL 61

Expert Comment

by:mbizup
ID: 40468938
Exactly.   We're taking shots in the dark here.

Jeff Coachman's use of the built in OpenForm should do the trick, however, with the assumption that your custom function is simply opening the form and not doing anything else.
0
 

Author Comment

by:cssc1
ID: 40505346
Thanks
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

821 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