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  

Yes/No from TextBox in query



 
 
Thread Tools Display Modes
  #1  
Old July 12th, 2007, 03:04 PM posted to microsoft.public.access.queries
Igor G.
external usenet poster
 
Posts: 38
Default Yes/No from TextBox in query

1. How to use values from [Form1]![Text1], in query?
Field in query is datatype Yes/NO.

When I put in query criteria values Yes/No, working OK.
But, when I call this values from [Form1]![Text1], not OK.

2. How to make... if is value NO query display all data with this parameter,
and if is value Yes display parameter with Yes and NO?

Thanks!
  #2  
Old July 12th, 2007, 03:12 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Yes/No from TextBox in query

Yes and No are not recognized values in VBA or Jet SQL. You need to use
eithe True or False.

True = -1
False = 0

--
Dave Hargis, Microsoft Access MVP


"Igor G." wrote:

1. How to use values from [Form1]![Text1], in query?
Field in query is datatype Yes/NO.

When I put in query criteria values Yes/No, working OK.
But, when I call this values from [Form1]![Text1], not OK.

2. How to make... if is value NO query display all data with this parameter,
and if is value Yes display parameter with Yes and NO?

Thanks!

  #3  
Old July 12th, 2007, 04:12 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Yes/No from TextBox in query

2. How to make... if is value NO query display all data with this parameter,
and if is value Yes display parameter with Yes and NO?
Did you mean to say both Yes and No if form input was Yes?

If not then try using an IIF statement --
IIF([Forms]![Form1]![Text1] = "Yes", -1, 0)

In this case your options are Yes, No, or All by just pressing ENTER at the
prompt.
IIf([Forms]![Form1]![Text1]="Yes",-1,0) Or Like
IIf([Forms]![Form1]![Text1] Is Null,"*")


--
KARL DEWEY
Build a little - Test a little


"Igor G." wrote:

1. How to use values from [Form1]![Text1], in query?
Field in query is datatype Yes/NO.

When I put in query criteria values Yes/No, working OK.
But, when I call this values from [Form1]![Text1], not OK.

2. How to make... if is value NO query display all data with this parameter,
and if is value Yes display parameter with Yes and NO?

Thanks!

 




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 01:33 AM.


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