View Single Post
  #7  
Old April 30th, 2010, 10:26 PM posted to microsoft.public.access.forms
JOSELUIS via AccessMonster.com
external usenet poster
 
Posts: 26
Default Search form with a checkbox.

I tried these two things but the problem is still there however i take an
example provided by Allen Browne, I change fdlgSearch chkResidents into an
unbound cboFilterResidents. In the RecordSource property :-
1;"Residents";0;"Not Residents" and put this code:

If Me.cboFilterResidents = -1 Then
' .. build the predicate
varWhere = varWhere & "([Resident]= True ) "
ElseIf Me.cboFilterResidents = 0 Then
varWhere = varWhere & "([Resident]= False )"
End If
And it works perfectly.Thank you very much for your time.
Best regards
Jose Luis (Spain)

Daryl S wrote:
Joseluis -

The True is the same as -1 (False is 0), so don't worry about that.

Try this:
Debug.Print ("SELECT tblContacts.* FROM tblContacts
WHERE " & varWhere)

Another thought on your syntax. As to the CurrentDB - I always used that as
a function to return the current database to a database variable. You may
want to include this:

dim db1 As Database
Set db1 = CurrentDB()

Then in your recordset statement, use db1 instead of CurrentDB.

Try those two things and let us know what you get.

Sorry because I misunderstood you before. I add the debug.print and this is
what is displayed in the inmediate window:

[quoted text clipped - 15 lines]
Whenever I tryed to execute the search an Error # 3061#is displayed and
the code is interrupted in this line.


--
Message posted via http://www.accessmonster.com