473,396 Members | 2,037 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,396 software developers and data experts.

Access Update query not running in VBA but runs manually

This part of code executes after the user logs in in the system in Access.
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Function updateShftDate()
  5.  
  6. On Error GoTo Macro6_Err
  7. DoCmd.SetWarnings False
  8. DoCmd.OpenQuery "qryShiftDate", acViewNormal, acEdit
  9.  
  10. Macro6_Exit:
  11. Exit Function
  12.  
  13. Macro6_Err:
  14. MsgBox Error$
  15. Resume Macro6_Exit
  16. DoCmd.SetWarnings False
  17.  
  18. End Function
  19.  
I've also tried replacing the
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery
with
Expand|Select|Wrap|Line Numbers
  1. currentDb.Execute
but is not working either. When I tried to set the
Expand|Select|Wrap|Line Numbers
  1. DoCMd.SetWarning
to TRUE, it pops-up the Warning message saying
Expand|Select|Wrap|Line Numbers
  1. You are about to run an update query that will modify your data in your table
This does not work when called in Access VBA. But this runs when the query is manually ran.
Mar 21 '17 #1
0 760

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

Similar topics

5
by: Don Seckler | last post by:
I have an update query that runs when a report closes. I have several reports that will need to run the update query with diferent criteria. I'd like to simply make the criteria change in the...
1
by: Wayne | last post by:
I've created a form that has many option boxes to help users choose items (I need option boxes vs. combo boxes because they can choose multiple items per category). I've created an update query...
1
by: New Guy | last post by:
Could someone please show me how to write an update to: Set the daily.Expense field to the total of the transactions.amount field where transDate = #07/05/04#? I have tried this with the query...
1
by: csgraham74 | last post by:
Hi Guys, I was wondering if someone could help me with an access query. I basicallly have two tables A & B Im table A there are numerous records with Fields1 & fields 2 I want to use...
5
by: Kosmos | last post by:
Good morning fellow programmers. Just a quick question I hope... I'm trying to run some SQL from VBA and I'm getting an error....I think it's Syntax? This is the code: Dim stSQL2
6
by: bobh | last post by:
Hi All, I'm looking for help with what the Transact SQL code is for this Access Update query sql code. I've been doing Access for some time and all my back-ends have been jet. I'm just starting...
1
by: tmoon3 | last post by:
Hi, I have an Access DB that tracks employee training. There are about 100 different training columns and I was given a list of employees (and employee id's prinmary key) that have completed...
5
by: teddysnips | last post by:
Having upsized my client's back-end DB to SQL Server, the following query does not work ("Operation must use an updateable query"). UPDATE tblbookings INNER JOIN tblREFUNDS ON...
2
by: arvarunar | last post by:
I have two tables: TrendMaster: EmployeeID, Joined_Period, Delay, Index, Branch, K *Joined_period takes month eg: "April", "March"... TrendSheet: Branch, April_Joined, April_Delay,...
2
by: Knowlton | last post by:
I have an update query that runs from an option group. I added another option and the update query for that option. This query is the same as another option so I copied it from the existing option....
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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.