Solved

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

Posted on 2014-11-26
9
115 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 …

832 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