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

How to insert "Or" & "and" at the same time in Docmd?

P: 29
Hi everybody,
First I'm sorry if the question is not set correctly. I'm new to access.

Well, I need help concerning the following code. I need to insert this in the code below which is working fine:

PaymentMethod = "Cash" or "Cheque"


Expand|Select|Wrap|Line Numbers
  1. "where CustomerId = Invoice_Id and Customers.CustomersStatus = 'Invoiced' and Barcode_Of_Goods ='" & Me.Barcode_Goods & "'"
  2.  
Please can someone help me?
Mar 1 '14 #1

✓ answered by Rabbit

Use IN instead.
Expand|Select|Wrap|Line Numbers
  1. PaymentMethod IN ('Cash', 'Cheque')

Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,430
Use IN instead.
Expand|Select|Wrap|Line Numbers
  1. PaymentMethod IN ('Cash', 'Cheque')
Mar 1 '14 #2

P: 29
Thanks a lot.

It works great. It is as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdUpdateSales_Click()
  2.  
  3. DoCmd.SetWarnings False
  4.  
  5. DoCmd.RunSQL "Update Customers,Sales set CustomersStatus = 'Closed', Action = 'On-Order'" & _
  6. "where CustomerId = Invoice_Id and Customers.PaymentType IN ('Cash','Cheque') and Customers.CustomersStatus = 'Invoiced' and Barcode_Of_Goods ='" & Me.Barcode_Goods & "'"
  7.  
  8.  
  9. DoCmd.RunSQL "Update Sales Set Sales.Action = 'On-Order'" & _
  10. "WHERE (Sales.Action)= 'Re-Order' and (Sales.[MOP of Payment]) IN ('Cash','Cheque') and (Sales.[Transaction Type])= 'Sold Re-Order' and (Sales.Barcode_Of_Goods)='" & Me.Barcode_Goods & "'"
  11.  
  12. Me.Requery
  13.  
  14. DoCmd.SetWarnings True
  15.  
  16. End Sub
Mar 1 '14 #3

Post your reply

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