473,566 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5295
You need to explicitly format the literal date in the SQL string, and use
the # delimiter:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & _
Format(Me!txtAp ptStart, "\#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******** **********@news svr25.news.prod igy.com...
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*********@Se eSig.Invalid> wrote in message
news:3f******** **************@ freenews.iinet. net.au...
You need to explicitly format the literal date in the SQL string, and use
the # delimiter:

DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " & _
Format(Me!txtAp ptStart, "\#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******** **********@news svr25.news.prod igy.com...
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
2329
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 retieves the values perfectly. This form is being used to update the record in the table via a successconfirmation.asp. Now, when the checkbox is loaded...
17
4980
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 cust_no, ded_type_cd, chk_no)
10
9322
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 record in the second table and call the update method of the data adapter the command builders update command text is for the first table. Can the...
8
14816
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
3434
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 the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the...
5
2191
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 database by equipment number (equipno is unique) and query all fields from that row, populating an original form 'look alike' whereby the user can...
14
4823
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 can be done using the designer but I intentionally don't want to use that. The one reason is that you cannot change the code generated by the...
3
2666
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 row of data, etc. then I thought it would be nice to do a select, and perhaps an update (the title of the image) on the same page.
3
1897
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 I am updating the CHANGE field with the difference between the main table's RATE field and the backup table's RATE field. For some reason, it is...
0
7673
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, 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...
0
7584
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...
0
7953
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...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
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...
0
5213
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...
0
3643
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
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.