Macro to VBA Conversion Error

Kutach770

Registered User.
Local time
Today, 09:44
Joined
Aug 7, 2014
Messages
14
Hello all. I'm new to this forum but am a self-educated access user from "Google University."

I've run into a problem involving a button on a form that, when clicked, opens another form to a specific record. The macro (which the wizard creates) is fine. But when I convert the macro into vba, I get an Expected End of Statement syntax error.

Could someone tell me what is wrong with this statement:

Docmd.OpenForm "Case_Action", acNormal, "", "[Case]=" &" '" [&CasePick] & "'", , acNormal

Thank you so much!
 
Just a guess, but try:

Docmd.OpenForm "Case_Action", acNormal, , "[Case]= '" & [&CasePick] & "'"

EDIT
I assume [Case] is a text field.
 
In addition, could &CasePick really be a field name?
 
In addition, could &CasePick really be a field name?
Good spot! I missed that.:o
Perhaps OP should try:
Docmd.OpenForm "Case_Action", acNormal, , "[Case]= '" & [CasePick] & "'"
 
It's possible it is bob because I don't think the macro converter will miss that, but weird.
 
Wow-thanks for responding so quickly. I will try your suggestion. Just to let you know the macro converter did include the & within the brackets. I can't imagine why the converter would create code with a syntax error. I'll let you know shortly.
 
It worked and I so appreciate it! Hopefully I can return the favor someday.
 
It worked and I so appreciate it! Hopefully I can return the favor someday.
And thank you for your kind words of appreciation. Glad you got it working. :) Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom