UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Filtering Records Based On Password Entered, Access 2013    
 
   
tina t
post May 21 2020, 02:40 PM
Post#21



Posts: 6,589
Joined: 11-November 10
From: SoCal, USA


how about the following, as

CODE
    If Nz(Me.txtDocSearchFilter, "") = "Corporate" Then
        DoCmd.OpenForm "frmDocumentSearch", acNormal, "", "", , acNormal
    ElseIf Nz(Me.txtDocSearchFilter, "") = "Haines City") Then
        DoCmd.OpenForm "frmDocumentSearch", _
        WhereCondition:="Site = 'CM' OR Site =  'FL'"
    End If

the Nz() function addresses the possibility of txtDocSearchFilter being Null, replacing the Null with a zero-length string so that the code doesn't err out. recommend you read up on the Nz() function in Help, so you understand how it works.

note that the above code provides for opening the form when one of the two specific values is entered in control txtDocSearchFilter. when neither of those values is entered, the form will not open. you need to consider if there are other circumstances where you want the form to open, and if so, then you need to make sure those situations are addressed in the code as well.

hth
tina
This post has been edited by tina t: May 21 2020, 02:40 PM

--------------------
"the wheel never stops turning"
Go to the top of the page
 
sarinadipity
post May 22 2020, 03:32 PM
Post#22



Posts: 42
Joined: 20-March 20



That code works a lot better but how do I do more ElseIf criteria? Ill need 7 in total
Go to the top of the page
 
FrankRuperto
post May 22 2020, 03:59 PM
Post#23



Posts: 969
Joined: 21-September 14
From: Tampa, Florida USA


In that case you're better of using the "Select Case" statement lol: https://docs.microsoft.com/en-us/office/vba...-case-statement

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix, Oracle & PostgreSQL db's.
Go to the top of the page
 
sarinadipity
post May 22 2020, 04:01 PM
Post#24



Posts: 42
Joined: 20-March 20



That one is new to me so I will have to test it out. At the end of it all I need that main filter to stay even when the search filters are used
Go to the top of the page
 
FrankRuperto
post May 22 2020, 04:03 PM
Post#25



Posts: 969
Joined: 21-September 14
From: Tampa, Florida USA


That's doable with the case statement.

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix, Oracle & PostgreSQL db's.
Go to the top of the page
 
projecttoday
post May 22 2020, 04:16 PM
Post#26


UtterAccess VIP
Posts: 12,168
Joined: 10-February 04
From: South Charleston, WV


Why can't you combine the 2 filters?

--------------------
Robert Crouser
Go to the top of the page
 
2 Pages V < 1 2


Custom Search


RSSSearch   Top   Lo-Fi    26th May 2020 - 07:05 AM