473,409 Members | 1,967 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,409 software developers and data experts.

Why does UPDATE query change data type?

I have an unbound text box on a form that is set to:

Format = Short Date (with the corresponding input mask)

When I run this:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & Me!txtApptStart)

the value in the table is only a time value, or some other incorrect date.

The data type and format of the table field matches that of the textbox
field.
I've tried messing around with DateValue and removing the input mask, but
keep getting screwy results.
There must be some way to get the date value into a table with a query...

Am I missing something obvious?
Nov 12 '05 #1
2 5290
You need to explicitly format the literal date in the SQL string, and use
the # delimiter:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & _
Format(Me!txtApptStart, "\#mm\/dd\/yyyy\#"))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <dj****@hotmail.com> wrote in message
news:Hc******************@newssvr25.news.prodigy.c om...
I have an unbound text box on a form that is set to:

Format = Short Date (with the corresponding input mask)

When I run this:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & Me!txtApptStart)

the value in the table is only a time value, or some other incorrect date.

The data type and format of the table field matches that of the textbox
field.
I've tried messing around with DateValue and removing the input mask, but
keep getting screwy results.
There must be some way to get the date value into a table with a query...

Am I missing something obvious?

Nov 12 '05 #2
thanks for the tip.

this was driveing me crazy...

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
You need to explicitly format the literal date in the SQL string, and use
the # delimiter:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & _
Format(Me!txtApptStart, "\#mm\/dd\/yyyy\#"))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <dj****@hotmail.com> wrote in message
news:Hc******************@newssvr25.news.prodigy.c om...
I have an unbound text box on a form that is set to:

Format = Short Date (with the corresponding input mask)

When I run this:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & Me!txtApptStart)

the value in the table is only a time value, or some other incorrect date.
The data type and format of the table field matches that of the textbox
field.
I've tried messing around with DateValue and removing the input mask, but keep getting screwy results.
There must be some way to get the date value into a table with a query...
Am I missing something obvious?


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jack | last post by:
Hi, I have a form when loaded, retrieves record from an access table. Among other fields there is a check box called FinalUpdate. This is tied to a field in Access of type Yes/No. The form...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
10
by: Hank1234 | last post by:
Can I use one Data Adapter and one Command Builder to update amny tables? Currently in my data adapter I query two tables and fill them into two tables in a data set. When I make a change to a...
8
by: ZeroVisio | last post by:
Hi, I want to know if there is an easy way to do update a column of a row in DataTable.
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
5
by: cover | last post by:
I have an input form that passes data when submitted to a second form to let the user know what they have just entered into the db. My question comes with using 'update'. I'd like to query the...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
3
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a...
3
by: fperri | last post by:
I have a field in my main table called "CHANGE". Each week before we update the data we create a backup of the table and adjust the CHANGE field for all records to zero. I have an update query where...
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...
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:
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
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
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
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...

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.