473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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')

2 873
Rabbit
12,516 Expert Mod 8TB
Use IN instead.
Expand|Select|Wrap|Line Numbers
  1. PaymentMethod IN ('Cash', 'Cheque')
Mar 1 '14 #2
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

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

Similar topics

7
by: Bercin Ates via SQLMonster.com | last post by:
I?m getting an error when I execute a stored procedure which is try to insert a row to a table. The error is: Server: Msg 1934, Level 16, State 1, Procedure SRV_SP_IS_EMRI_SATIRI_EKLE, Line 32...
0
by: Dale Ring | last post by:
Access 2000 Each record has several time fields (short time format). I'm using the following 2 Textboxes to determine actual "Scene Time" =DateDiff("n",,) =\60 & Format( Mod 60,"\:00") ...
0
by: typingcat | last post by:
I live in GMT+9 The SQL server is in GMT+0 I used GridView to display 'time' column from SQL server. I need to add 9 hours for each time but how can I do this? Can I solve this by query statement...
6
by: flash | last post by:
write a program that manipulates arrays of integers. The main program should call three functions: Insert, Delete, and Search. The Insert function should call a function Sort that sorts the array. ...
1
by: Kushwaha | last post by:
Hi, I want to update a field in primary table using a single trigger when I using a foriegn table at the time of inserting a value, deleting a value or modifying that value.
6
by: Peter Nurse | last post by:
For reasons that are not relevant (though I explain them below *), I want, for all my users whatever privelige level, an SP which creates and inserts into a temporary table and then another SP...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
0
by: onlymukti4u | last post by:
Hi All, Can anyone help me out to get the code for knowing the login and logout time difference between some pages. What exactly I want is...."I have a small project having 5 pages,once the...
3
by: perhapscwk | last post by:
I using a insert query to insert some data into mysql. I use now() as the current date and time but it always have 3.X hours different from actual date. what i should use instead? thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.