473,695 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Update query not running in VBA but runs manually

3 New Member
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
  4. Function updateShftDate()
  6. On Error GoTo Macro6_Err
  7. DoCmd.SetWarnings False
  8. DoCmd.OpenQuery "qryShiftDate", acViewNormal, acEdit
  10. Macro6_Exit:
  11. Exit Function
  13. Macro6_Err:
  14. MsgBox Error$
  15. Resume Macro6_Exit
  16. DoCmd.SetWarnings False
  18. End Function
I've also tried replacing the
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery
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 772

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

Similar topics

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 report vba instead of making different queries. Here's my query sql: UPDATE Draw SET Draw.Billed = Yes WHERE (((Draw.Billed)=No) AND ((Draw.WholesalerName)="Hudson"));
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 to change the value from –1 (system automatically generates that) to the actual value I want. In the criteria section of the append query, I put a simple if statement: IIf("-1","London",""). Regardless of the value that is found however, the...
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 builder or wizard and it says my query doesn't use a field named "Expense". This is true because I'm using the field named "amount" from the detail table. I'm a bit (a lot) stymied by this.
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 table B to update table A. Bascically i need to compare table A & Table B - if records exist in Table B that are not in Table A
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
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 with SQLServer back- ends and I'm wanting to change those queries that can be changed to pass-thru queries using T SQL were I can. UPDATE tblHospLineFinal INNER JOIN tblCodes ON tblHospLineFinal.RemarkCode = tblCodes.CodeID SET...
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 First Aid training. Besides exporting the data into excel then doing a vlookup on the SSN's to get the completed training dates for First Aid Then re-importing all of the data back into my Access DB, is there a way that I can have a VBA script or VB...
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 tblbookings.TransFromID = tblREFUNDS.BookingID SET tblREFUNDS. = tblbookings! bookingid WHERE (((tblREFUNDS.)=0) AND ((tblbookings.TransFromID) Is Not Null)); I tried rewriting it as follows, with the same problem:
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, April_Index, May_Joined...so on till March_Delay, March_Index I need to update April_Index with: Average of K factor of employees in TrendMaster for whome Joined_period is April-09 and these need to be grouped as TrendMaster.Branch=TrendSheet.Branch
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. When this option runs I get an error message: "The Microsoft Jet database engine cannot find the input table or query ". Make sure that it exists and that its name is spelled correctly." The exact same query runs fine in the other option. Here...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.