By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,503 Members | 2,788 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,503 IT Pros & Developers. It's quick & easy.

Multiple criteria in where clause to open a form?

P: 99
Is the following statement correct/
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm Me.Name, , , "[A_PRIORITY] = '" & _ cboPrior & "'" AND "[A_LOCATION] = '" & _ cboLocate & "'" 
I am trying to give two conditions to open a form here.However nothing happens.
Mar 19 '12 #1

✓ answered by NeoPa

No. It has various problems, mainly related to what is inside, and what is outside, your string values.

Try something like :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenForm(FormName:=Me.Name, _
  2.                     WhereCondition:="([A_PRIORITY] = '" & Me.cboPrior & "') AND " & _
  3.                                     "([A_LOCATION] = '" & Me.cboLocate & "')")

Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,186
No. It has various problems, mainly related to what is inside, and what is outside, your string values.

Try something like :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenForm(FormName:=Me.Name, _
  2.                     WhereCondition:="([A_PRIORITY] = '" & Me.cboPrior & "') AND " & _
  3.                                     "([A_LOCATION] = '" & Me.cboLocate & "')")
Mar 19 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.