A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem Updating Date Fields



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2008, 11:22 PM posted to microsoft.public.access
Sharkbyte
external usenet poster
 
Posts: 110
Default Problem Updating Date Fields

I have a form with approximately 20 date fields. Anytime it is updated, only
1 or 2 fields might be populated. The update code updates all 20 fields, but
the code fails on any fields returning "".

What am I missing with saving these fields?

Code example:

docmd.runsql ("update tblTestingDates set testLLC = txttestllc, testHDV =
txttestHDV where customerID = txtcustomerid;")

If one of the controls returns "" I get a conversion failure.

Any ideas are greatly appreciated.

Thanks.

Sharkbyte
  #2  
Old October 27th, 2008, 11:48 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Problem Updating Date Fields

Maybe I'm misunderstanding ... it sounds like you are saying your data
includes multiple fields for date-related information. Is that your
underlying data (i.e., tables), or just how you've chosen to display a
well-normalized table structure on a form?

We aren't there. "Anytime it is updated" means ... ?!what?!

It all starts with the data ... start with the data to give us a better
context.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Sharkbyte" - wrote in message
...
I have a form with approximately 20 date fields. Anytime it is updated,
only
1 or 2 fields might be populated. The update code updates all 20 fields,
but
the code fails on any fields returning "".

What am I missing with saving these fields?

Code example:

docmd.runsql ("update tblTestingDates set testLLC = txttestllc, testHDV =
txttestHDV where customerID = txtcustomerid;")

If one of the controls returns "" I get a conversion failure.

Any ideas are greatly appreciated.

Thanks.

Sharkbyte



  #3  
Old October 28th, 2008, 12:22 AM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Problem Updating Date Fields

On Mon, 27 Oct 2008 16:22:09 -0700, Sharkbyte - wrote:

I have a form with approximately 20 date fields. Anytime it is updated, only
1 or 2 fields might be populated. The update code updates all 20 fields, but
the code fails on any fields returning "".

What am I missing with saving these fields?

Code example:

docmd.runsql ("update tblTestingDates set testLLC = txttestllc, testHDV =
txttestHDV where customerID = txtcustomerid;")

If one of the controls returns "" I get a conversion failure.


A Date/Time value can never contain a text string, even the empty text string
"". It can contain NULL unless the field is required - might any of the target
fields have their Required property set to yes? Or are you perhaps copying
text fields into date/time fields?
--

John W. Vinson [MVP]
  #4  
Old October 28th, 2008, 02:46 PM posted to microsoft.public.access
Sharkbyte
external usenet poster
 
Posts: 110
Default Problem Updating Date Fields

John, Thank you.

This problem was a by-product of my just starting out w/ developing a
full-blown app, about 3 years ago. And I haven't had to deal w/ a large
number of date fields, on anything else...

Turns out I was running several IIF statements, replacing the NULLs w/ "".
After changing that, everything saves fine.

Thanks, again.

Sharkbyte


"John W. Vinson" wrote:

On Mon, 27 Oct 2008 16:22:09 -0700, Sharkbyte - wrote:

I have a form with approximately 20 date fields. Anytime it is updated, only
1 or 2 fields might be populated. The update code updates all 20 fields, but
the code fails on any fields returning "".

What am I missing with saving these fields?

Code example:

docmd.runsql ("update tblTestingDates set testLLC = txttestllc, testHDV =
txttestHDV where customerID = txtcustomerid;")

If one of the controls returns "" I get a conversion failure.


A Date/Time value can never contain a text string, even the empty text string
"". It can contain NULL unless the field is required - might any of the target
fields have their Required property set to yes? Or are you perhaps copying
text fields into date/time fields?
--

John W. Vinson [MVP]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.