Adding a Date data-type field with a Make-Table query

B

bigomega73

I am using a make-table query to make a table. Some of the fields are being
populated with this query, however I need to add several more fields with
null values so that they can be updated by subsequent update queries. The
default field-type that is created if I just put in a field name is Text. How
can I create a Date field-type field from a make-table query which has a null
value?
 
G

George Nicholson

Well, you can create a DateTime field by using something like:
DateField: CDate(0)
But the field won't be empty, it will contain 0, or, stated as a date value,
Dec 30, 1899 12:00 am.

I don't know of any way to force the creation of a DateTime field in a
MakeTable query without providing a Numeric value.

Workaround: since you say you have subsequent Update queries that you run
against this table:
1) use the above in your MakeTable
2) run an additional Update query right after table creation that
changes DateField from 0 to Null
 
G

Guillermo_Lopez

Instead of a Maketable query, Create the Table how you want it (Here
you set the date field).
Then change the MakeTable query to an Append Query. Make sure you run
a Delete Query to delete all the rows before you use the Append Query.

- GL
 
B

bigomega73

Thanks for the suggestion George. That is actually how I ended up working
around it. I don't like to add too many unnecessary queries to my database,
but I guess in this case there was no way around it.
 

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