Conditional Macro Wildcard

  • Thread starter Thread starter mlmo300
  • Start date Start date
M

mlmo300

Guest
Conditional macro wildcard help, please.

I am trying to create a conditional macro and am having considerable difficultly finding the correct syntax (I'm very much a newbie to VBA and SQL, I can't even figure out which one I'm supposed to be using here).

The value of the field "SmplNmbr" is a letter (A, B, C, or D) followed by two numbers. I would like the macro to run based on the first letter.

I have tried several permutations in the "Condition" column:

[Forms]![Logentry]![SmplNmbr]="A*"
[Forms]![Logentry]![SmplNmbr]="A%"
[Forms]![Logentry]![SmplNmbr]="A??"
[Forms]![Logentry]![SmplNmbr]="A##"
[Forms]![Logentry]![SmplNmbr]=[A]
[Forms]![Logentry]![SmplNmbr]="A__"
[Forms]![Logentry]![SmplNmbr]="A[##]"
[Forms]![Logentry]![SmplNmbr]="A[%]"
[Forms]![Logentry]![SmplNmbr]="A[*]"

And I'm no longer sure what all else, all to no avail. My head hurts. I would appreciate the insight of someone who is familiar with the correct syntax.

Thank you!
 
[Forms]![Logentry]![SmplNmbr]=Like "A*"
 
=Like "A*" is unparsible

I tried this and got a "can't parse" error
 
LEFT([Forms]![Logentry]![SmplNmbr],1) = "A"
 
That's the ticket. I thought I read something about that in the Bible, but I can't find it. Thanks much.
 

Users who are viewing this thread

Back
Top Bottom