473,799 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

runsql update error with date

1 New Member
Hello
I have a subform and to edit the data I place it on the main form where changes can be made, then a cmd button is used to execute the docmd.runsql update query. However I am constantly getting an error msg (syntax error in UPDATE statement). Here is my code:
Expand|Select|Wrap|Line Numbers
  1. updateSQL = "UPDATE Assistance SET " & _
  2. "Date =" & editDatetxt & ", "  & _
  3. "Assistance ='" & Me.aAssistancetxt & "', " & _
  4. "Amount =" & Me.aAmounttxt & " " & _
  5. "WHERE assistanceID =" & Me.aAIDtxt
  6.  
  7. DoCmd.RunSQL updateSQL
I have located the cause of the error to the line ["Date=" & editDatetxt & ", " & _ ] I have tried adding ' and # around editDatetxt but I keep getting the error. Assistance.date is formated as date/time (short date) and editDatetxt is also formatted to short date.
Any help greatly appreciated.
TIA
Apr 2 '07 #1
1 4105
MMcCarthy
14,534 Recognized Expert Moderator MVP
Try this ...

Expand|Select|Wrap|Line Numbers
  1. updateSQL = "UPDATE Assistance SET " & _
  2. "Date =#" & Me.editDatetxt & "#, "  & _
  3. "Assistance ='" & Me.aAssistancetxt & "', " & _
  4. "Amount =" & Me.aAmounttxt & " " & _
  5. "WHERE assistanceID =" & Me.aAIDtxt
  6.  
  7. DoCmd.RunSQL updateSQL
Also change the name of the Date field to something else and Date is a function in Access and this might be causing a problem.

Mary
Apr 2 '07 #2

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

Similar topics

2
2079
by: Sims | last post by:
Hi, I have a table with 3 columns, something like... NAME, VALUE, DATE, (String(255), int(11), int(11)). And for argument lets say the data is row = "A", 10, 1076968526 row = "A", 10, 1076710733
3
12973
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able to tell when people have added notes to a record. (this database contains 6000+ records) I want to set it up so that "Notes Update" is updated to the current date whenever someone actually enters data into, or modifies data in, the "Notes"...
4
10194
by: Rotsj | last post by:
Hi, i try to execute an update query from within a form, but i get the message: run time error '3144'. Syntax error on the update statement when i try something like this: DoCmd.RunSQL "UPDATE tblKlant " & _ "SET tblKlant.Bedrag = tblKlant.Bedrag + 10.96" & _ " WHERE tblKlant. = forms!!"
8
11243
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to update 3 row(s)." Is there a way to prevent the message from popping up?
3
1535
by: spw | last post by:
Hello, I am beginner/intermediate user of Access and primariy use the 'Tables' and Queries' objects. I have a query that is pointing to a set of tables that will be updated every week. This query summarizes data and links to an Excel template report. Each week, I will need to do two things: 1) Re-import the data into Access and over-write the old tables, and 2) Update the date restriction in the where statement because the time...
2
15150
by: kaka | last post by:
I'm runnig Redhat 7.3 with postgresql 7.3.4 builded from sources and upgraded recently. I receive this error ( never received before upgrade ) and I don' t know what to do. Error while executing the query; ERROR: date/time field value out of range: "28/05/2004 02:15:57" SQL = "insert into...
1
3812
by: Reshmi Jacob | last post by:
Hello, Can any one help me in creating a trigger to update system date into a table while inserting a record into that table. I tried it like this, it is showing error !!! The following error has occurred: ORA-04091: table ACG.CENTREMST is mutating, trigger/function may not see it ORA-06512: at "ACG.CENTREMST_INSERT", line 5 ORA-04088: error during execution of trigger 'ACG.CENTREMST_INSERT'
3
1217
by: UAlbanyMBA | last post by:
I am trying to update a record but I keep receiving an error, "Data type mismatch in criteria expression." Here is the code: DoCmd.RunSQL ("Update Caller2 SET Ext = '" & Me!txtExt & "' where CallerID ='" & GlobalCID & "'") It has something to do with the where clause. The code "worked" when I forgot to include it. I need to be able to update a bunch of fields, but broke them down one by one to debug, and reached the conclusion it is...
22
3603
by: tonialbrown | last post by:
I have an Sql update statement that I am using that updates the data from a record chosen by the user from a list box lstDelFrom. This is working for all the text fields & updates fine. Once I add in one of the fields that is a Date field I cannot get the update to work. ie) this line ". = #" & Nz(rst.Fields(9).Value, "") & "#," & _ Could someone assist me with the correct syntax to use. I also need to consider that the field may be...
0
9538
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,...
0
10470
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10214
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,...
0
10023
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 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...
1
7561
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 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...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
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...
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.