Yes/No from TextBox in query

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

Guest

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!
 
Yes and No are not recognized values in VBA or Jet SQL. You need to use
eithe True or False.

True = -1
False = 0
 
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,"*")
 
Back
Top