Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Search

Status
Not open for further replies.

Moxy1

Programmer
Aug 29, 2002
75
US
I have the following code that works, but I'm wondering if there may be an easier approach code wise. Basically I have 3 radial buttons that the users can select. Once selected they are they prompted for a search criteria. They can have any combination of the 3 radials.

Code:
Dim strCriteria As String
strCriteria = ""

If IsNull(Me.optLoc) = False Then
    strCriteria = strCriteria & "[loc_no] ='" & InputBox("Enter State", "Loc") & "' AND"
End If

If IsNull(Me.optAmount) = False Then
    strCriteria = strCriteria & "[inv_no] =" & InputBox("Enter Inventory ID", "Amount") & " AND"
End If

If IsNull(Me.optClient) = False Then
    strCriteria = strCriteria & "[wr_no] ='" & InputBox("Enter Work Order Number", "Client") & "' AND"
End If

If Len(strCriteria) = 0 Then
Me.Filter = ""
Me.FilterOn = False
Else
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
End If
MsgBox strCriteria
DoCmd.OpenForm "frmEntry", acNormal, , strCriteria

Me.optLoc = Null
Me.optAmount = Null
Me.optClient = Null
 
is this all in one function in a button's event or something?

I'd actually put the individual input box prompts in the AfterUpdate of each radio button, and use either a form variable or global variable to save the filter criteria.

well, what I'd really do is to have 3 text (or combo) boxes for the criterias, and just let the users fill in those boxes as needed, then parse the results of those boxes...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top