Multiple variables for field in a report search!?!?

llaadd

Registered User.
Local time
Today, 05:00
Joined
Jun 22, 2010
Messages
18
Hi,

I am trying to open a report, where the the criteria is that the "status" field in a table is either one of the following:

  • Awaiting Stock
  • In-Progress
  • On-Hold
  • Returned to Factory
  • RMA Requested
I have tried searching for a solution to this on this forum and others, but unable to find, I'm probably just looking for the wrong thing! please can you advise how I can do this, I have tried doing like this:

DoCmd.OpenReport "RMA Report", acViewReport, , [Status] = "Awaiting Stock" Or "In-Progress" Or "On-Hold" Or "Returned to Factory" Or "RMA Requested"
Any help would be greatly appreciated, thank you.
 
The syntax would be:

"[Status] = 'Awaiting Stock' Or [Status] = 'In-Progress' Or..."
 
The syntax would be:

"[Status] = 'Awaiting Stock' Or [Status] = 'In-Progress' Or..."

thanks, I will try that tomorrow, I thought I did it like that also and it didn't seem to work, but maybe I had a typo or something!
 
Note how Paul has used double quotes around the whole expression and single quotes around each value.

By the way you can also use In like this:
Code:
"[Status] In ('Awaiting Stock','In-Progress','On-Hold','Returned to Factory','RMA Requested')"

Chris
 
Note how Paul has used double quotes around the whole expression and single quotes around each value.

By the way you can also use In like this:
Code:
"[Status] In ('Awaiting Stock','In-Progress','On-Hold','Returned to Factory','RMA Requested')"
Chris
thanks, will try both ways, I noticed that when i was looking at it and i'm sure i did something similar to pbaldy's way but knowing me I made some silly mistake lol!

will post results tomorrow when I'm able to try this.
 
If you don't want to hard code data into your module, which I never do. Then in the lookup table for the status field add another field. That field will have either a number or yes/no which will correspond to the status.

When you add a new status to the lookup table you merely add a yes/no or a numeric value.

Then whenever you are writing code to open a report it will look at the yes/no filed that is in the same lookup record as the status.

You can then have the admin of the system add new lookup records in the future.

If this doesn't make sense, let me know.
 

Users who are viewing this thread

Back
Top Bottom