Docmd.OpenForm WHERE condition trouble

So you need to at least surround it with single quotes.?
Are any of the names likely to have a single quote in them?

try
Code:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]='" & Me.Logged_In & "'"
This is the code I am using currently, does the same thing. None of the usernames have single quotes around them
 
What are the consequences? What error do you get
 
What are the consequences? What error do you get
No error. It gives me the prompt i posted earlier, the prompt for entering the parameter value using the Logged_in value as the name of the prompt. If I type the value in the parameter box it will do what I need but I need it to simply go directly to the form with filtered by the user name.
 
You are no longer using single quotes. :(, hence access thinks the contents is a variable name?
 
You are no longer using single quotes. :(, hence access thinks the contents is a variable name?
This is what i am using:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]=’" & Me.Logged_In & “‘“, , acWindowNormal

This is the result, “arivera” is a user on the list of Logged_in:
1586977218154.png
 
It does not help when you post code without code tags as ' and " are too close together.
The last suggestion was NOT using single quotes?

Having copied and pasted your code within code tags, you do not appear to be using single quote, but something similar at the start of the variable, which can be seen in the prompt.?

Code:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]=’" & Me.Logged_In & “‘“, , acWindowNormal

this works for me
Code:
DoCmd.OpenForm "Form1", acFormDS, , "[Field2]='" & tt & "'"
also
Code:
DoCmd.OpenForm "Form1", acFormDS, , "[Field2]=""" & tt & """"
so why not you?
 
It does not help when you post code without code tags as ' and " are too close together.
The last suggestion was NOT using single quotes?

Having copied and pasted your code within code tags, you do not appear to be using single quote, but something similar at the start of the variable, which can be seen in the prompt.?

Code:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]=’" & Me.Logged_In & “‘“, , acWindowNormal

this works for me
Code:
DoCmd.OpenForm "Form1", acFormDS, , "[Field2]='" & tt & "'"
also
Code:
DoCmd.OpenForm "Form1", acFormDS, , "[Field2]=""" & tt & """"
so why not you?
I’ve tried your suggestions. They only add single or double quotes to the front of the name of the prompt box.
 
Copy and paste my code exactly as it is.

Code:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]='" & Me.Logged_In & "'", , acWindowNormal
 
Copy and paste my code exactly as it is.

Code:
DoCmd.OpenForm "AuditClicksUsers", acFormDS, , "[User]='" & Me.Logged_In & "'", , acWindowNormal
Works perfectly. WTH did i miss? I thought I was using the exact code, where did i go wrong?
 
Look closely at what you *thought* were single quotes in post 27

Not sure of your language, but they were not single quotes to me?
 
Look closely at what you *thought* were single quotes in post 27

Not sure of your language, but they were not single quotes to me?
My language is English. I guess I missed that. I am working remotely on an ipad and the text size is smaller than im used to. Thanks for your help, i appreciate it very much.
 

Users who are viewing this thread

Back
Top Bottom