473,396 Members | 1,877 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.

Updating table with Date using SQL

30
Hey all,

I'm trying to update a table using sql with todays date.

I use this,

Expand|Select|Wrap|Line Numbers
  1. Dim todaysDate As Date
  2.  
  3. todaysDate = Date
  4.  
  5. DoCmd.SetWarnings False
  6. DoCmd.RunSQL "UPDATE Followup " & _
  7.              "SET Followup.EmailSentDate = " & todaysDate & ", Followup.Completed = 'Yes'" & _
  8.              "WHERE (((Followup.ID) = " & Main.followupID2 & "))"
  9. DoCmd.SetWarnings True
Everything is working fine, but the Followup.EmailSentDate is always the time i.e. 12:00:56 not the date.
The field is a Date/Time field, but i just don't understand why it doesn't place the date there.

All help welcome,

Thanks
Jun 4 '07 #1
2 10929
mlevit
30
Got it

Expand|Select|Wrap|Line Numbers
  1.       Dim todaysDate As Date
  2.       todaysDate = Date
  3.  
  4.       DoCmd.SetWarnings False
  5.       DoCmd.RunSQL "UPDATE Followup " & _
  6.                    "SET Followup.EmailSentDate = " & "'" & todaysDate & "'" & ", Followup.Completed = 'Yes'" & _
  7.                    "WHERE (((Followup.ID) = " & Main.followupID2 & "))"
  8.       DoCmd.SetWarnings True
Need to place " ' " before and after the date
Jun 4 '07 #2
ADezii
8,834 Expert 8TB
Hey all,

I'm trying to update a table using sql with todays date.

I use this,

Expand|Select|Wrap|Line Numbers
  1. Dim todaysDate As Date
  2.  
  3. todaysDate = Date
  4.  
  5. DoCmd.SetWarnings False
  6. DoCmd.RunSQL "UPDATE Followup " & _
  7.              "SET Followup.EmailSentDate = " & todaysDate & ", Followup.Completed = 'Yes'" & _
  8.              "WHERE (((Followup.ID) = " & Main.followupID2 & "))"
  9. DoCmd.SetWarnings True
Everything is working fine, but the Followup.EmailSentDate is always the time i.e. 12:00:56 not the date.
The field is a Date/Time field, but i just don't understand why it doesn't place the date there.

All help welcome,

Thanks
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings False
  2.  
  3. Dim MySQL As String
  4.  
  5. MySQL = "UPDATE Followup SET Followup.EmailSentDate = Date(), "
  6. MySQL = MySQL & "Followup.Completed = 'Yes' WHERE Followup.ID = " & Main.followupID2
  7.  
  8. DoCmd.SetWarnings True
Jun 5 '07 #3

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

Similar topics

6
by: Hasanain F. Esmail | last post by:
Hi all, I sincerly thank you all in advance for your help to solve this problem. I have been trying to find a solution to this problem for sometime now but have failed. I am working on a...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
3
by: Trez | last post by:
Hey guys, Am new at using ASP.Net. am having some problems updating my SQL DB. whenever i try i get this Error. Can someone help me? Incorrect syntax near 'nvarchar'. Description: An unhandled...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
11
by: xelA | last post by:
Thanks, it worked. Another problem: Hey folks, where is the bug in this code? When updating the date field, it is updating all the records in the table with the same value (e.g. 2008-01-07) instead...
2
tdw
by: tdw | last post by:
Hi all, I have several ideas on how to do this, but am having difficulty putting the ideas together and figuring out the most efficient way to do this. I have a database of survey coordinate...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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,...

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.