Open Form based on Mutiple Combo Selection

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.
 
M

Mark Phillipson

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top