Yes/No from TextBox in query

I

Igor G.

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!
 
K

Klatuu

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

True = -1
False = 0
 
K

KARL DEWEY

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,"*")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top