There is a field in tblContacts named Residents.txt which is a yes/no field.
What I´m trying to create is a checkbox in my fdlgsearch [chkResidents] which
filters my records. I mean if [chkResidents] is not selected all the records
should appear but if [chkResidents] = True only the records in my
frmContacts that are residents should appear.
I have put the following code of a sample database but it doesn´t work.
Could anybody give me a hint ?
Private Sub cmdSearch_Click()
Dim varWhere As Variant
Dim rst As DAO.Recordset
' Initialize to Null
varWhere = Null
...
' Do Residentes next
If (Me.chkResidentes = True) Then
' Build a filter to include only resident contacts
varWhere = (varWhere + " AND ") & _
"(Residentes = True)"
Set rst = CurrentDb.OpenRecordset("SELECT tblContacts.* FROM tblContacts
WHERE " & varWhere)
Whenever I tryed to execute the search an Error # 3061#is displayed and
the code is interrupted in this line.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201004/1