Check Box coding

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

Guest

I've set up a form which searches using a dynamic query. I have 26 potential
text fields that can be entered in any combination to search...

My problem arises when I've been asked to add a check box to my search to
further single out records via yes/no criteria in conjunction with the
initial 26 field text search.

How on earth would I go about coding this?

Here is a sample of my text code...

If Not IsNull(Me![LOI1]) Then
where = where & " AND [LOI] between " + _
Me![LOI] + " AND " & Me![LOI1] & ""
Else
where = where & " AND [LOI]= " + Me![LOI] + ""
End If

Thanks in Advance.

Chris
 
Hi Chris

It depends on what you mean by "in conjunction with". If you simply mean
that you want to add a test for a yes/no field then do this:

If Me.CheckBox <> 0 then
where = where & " AND [YesNoField]<>0"
Else
where = where & " AND [YesNoField]=0"
End If
 
Thanks a Bunch,

Works perfect, just had to change the end to allow for all records to be
displayed if check box was empty.

Thanks again,

Chris

Graham Mandeno said:
Hi Chris

It depends on what you mean by "in conjunction with". If you simply mean
that you want to add a test for a yes/no field then do this:

If Me.CheckBox <> 0 then
where = where & " AND [YesNoField]<>0"
Else
where = where & " AND [YesNoField]=0"
End If

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Chris said:
I've set up a form which searches using a dynamic query. I have 26
potential
text fields that can be entered in any combination to search...

My problem arises when I've been asked to add a check box to my search to
further single out records via yes/no criteria in conjunction with the
initial 26 field text search.

How on earth would I go about coding this?

Here is a sample of my text code...

If Not IsNull(Me![LOI1]) Then
where = where & " AND [LOI] between " + _
Me![LOI] + " AND " & Me![LOI1] & ""
Else
where = where & " AND [LOI]= " + Me![LOI] + ""
End If

Thanks in Advance.

Chris
 
Back
Top