Make Table Query changes Data Type

  • Thread starter rirus via AccessMonster.com
  • Start date
R

rirus via AccessMonster.com

I have a date field in a Make Table Query called dteCreated. When the query
runs if there is an entry that already has a date it leaves it but if there
is no date, then it enters the current date/time. Here is what I have...
Date Created: NZ([dteCreated],Now())

When it runs it will enter the date if needed and if there is already a date,
it will leave it alone. My problem is... the Data Type for Date Created
changes to text. I am guessing the Make Table Query is deciding what that
Data Type should be. Is there a way to fix this in the query?

Thanks,

rirus
 
M

MGFoster

rirus said:
I have a date field in a Make Table Query called dteCreated. When the query
runs if there is an entry that already has a date it leaves it but if there
is no date, then it enters the current date/time. Here is what I have...
Date Created: NZ([dteCreated],Now())

When it runs it will enter the date if needed and if there is already a date,
it will leave it alone. My problem is... the Data Type for Date Created
changes to text. I am guessing the Make Table Query is deciding what that
Data Type should be. Is there a way to fix this in the query?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Actually, it is the Nz() function: most of the time it transforms the
data to text. Do something like this:

CDate(Nz(dteCreated,Now()))

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSuJgf4echKqOuFEgEQL83QCfTvmsgQVn1TnuaI8fAH10zIjEGbYAn2i/
ZpipEBNBbsaWTTOfEYyiJqd1
=keIf
-----END PGP SIGNATURE-----
 
R

rirus via AccessMonster.com

This did the trick. I was thinking it was the Nz. It worked great, always
giving me a new date if it was blank and now, it is perfect as the data type
is always Date/Time.

Thank you MGFoster

rirus
I have a date field in a Make Table Query called dteCreated. When the query
runs if there is an entry that already has a date it leaves it but if there
[quoted text clipped - 5 lines]
changes to text. I am guessing the Make Table Query is deciding what that
Data Type should be. Is there a way to fix this in the query?

Actually, it is the Nz() function: most of the time it transforms the
data to text. Do something like this:

CDate(Nz(dteCreated,Now()))

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top