From: Daryl S on
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.

--
Daryl S


"JOSELUIS via AccessMonster.com" wrote:

> Sorry because I misunderstood you before. I add the debug.print and this is
> what is displayed in the inmediate window:
> (Residents = True)
> I´ve tried to change chkResidents= -1 but I haven´t solved the problem. Any
> suggestions?
> Daryl S wrote:
> >Joseluis -
> >
> >OK, you won't have a leading AND unless Me.cmbEmpleo is empty.
> >
> >Add the debug.print varWhere as I mentioned before - right before the Set
> >rst statement. Step through it and post what is displayed on that step in
> >the immediate window. You may spot the issue from that yourself. Otherwise
> >post it and we can help spot the issue.
> >
> >> Thank you Daryl S for your time , the code os the fdlgSearch is as following:
> >>
> >[quoted text clipped - 141 lines]
> >> >> 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/Forums.aspx/access-forms/201004/1
>
> .
>
From: JOSELUIS via AccessMonster.com on
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

First  |  Prev  | 
Pages: 1 2
Prev: Make invisible with a checkbox
Next: Combo box problem