Open Form based on Mutiple Combo Selection

  • Thread starter Thread starter thefoxuk
  • Start date Start date
T

thefoxuk

To Anyone That Can Help,

I am currently writing a support database for users using
SQL and Access however my minimal knowledge in VB has
meant that i have become stuck.

Basically, I have a form that i want to open, i can open
that form using one combo selection using the following
code:

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Closed Jobs1"

stLinkCriteria = "[Technician Username]=" & "'" & Me!
[Combo13] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click

End Sub

However i want to be able to open this form and show the
data of mutiple comparisions.
 
Hi,

You just need to build the stLinkCriteria string with the other criteria:

stLinkCriteria = "[Technician Username]=" & "'" & Me![Combo13] & "'"

stLinkCriteria = stLinkCriteria & " Or [Technician Username]=" & "'" &
Me![Combo14] & "'"

stLinkCriteria = stLinkCriteria & " Or [Technician Username]=" & "'" &
Me![Combo15] & "'"

Basically the WhereCondition is just like a normal SQL Where clause without
the word Where.


--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 
Back
Top