>=[forms]![main menu]![from %] And <=[forms]![main menu]![To %]

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

=[forms]![main menu]![from %] And <=[forms]![main menu]![To %] or Like
=[forms]![Main Menu]![From %] & "*"

Can someone tell me what is wrong with this? I have this on a query and I
want to pull a report using these parameters. Part of it works fine but when
I want to get all records I get a blank report. I have tried different ways
of doing this but I can never get it to work. Please help.

I've also tried
=[forms]![main menu]![from %] And <=[forms]![main menu]![To %] or >=[forms]![Main Menu]![From %] Is null
 
Switch your query to SQL View (View menu, in query design.)

In the WHERE clause you will see something like this:
WHERE [Table1].[Field1] >= [forms]![Main Menu]![From %]
AND [Table1].[Field1] <= [forms]![Main Menu]![To %]

Change it to this kind of thing:
WHERE ([forms]![Main Menu]![From %] Is Null
OR [Table1].[Field1] >= [forms]![Main Menu]![From %])
AND ([forms]![Main Menu]![To %] Is Null
OR [Table1].[Field1] <= [forms]![Main Menu]![To %])

The bracketing is important here.

Each part of the WHERE clause evaulates to True or False.
If the from text box is blank, then:
[forms]![Main Menu]![From %] Is Null
is true. If it is not blank, the only way first part can evalute to True is
if the field is indeed greater than the text box value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

brown_eyes said:
=[forms]![main menu]![from %] And <=[forms]![main menu]![To %] or Like
=[forms]![Main Menu]![From %] & "*"

Can someone tell me what is wrong with this? I have this on a query and I
want to pull a report using these parameters. Part of it works fine but
when
I want to get all records I get a blank report. I have tried different
ways
of doing this but I can never get it to work. Please help.

I've also tried
=[forms]![main menu]![from %] And <=[forms]![main menu]![To %] or
=[forms]![Main Menu]![From %] Is null
 
Back
Top