A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old April 24th, 2006, 04:48 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default =[forms]![main menu]![from %] And =[forms]![main menu]![To %]

=[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

  #2  
Old April 24th, 2006, 04:59 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default =[forms]![main menu]![from %] And =[forms]![main menu]![To %]

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.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"brown_eyes" wrote in message
...
=[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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.