Update 2 fields in an existing table.

S

sdesh

I have a table that comes in to access through an import. The import does
not contain the month or year so this will need to be added on a monthly
basis. I created in the table the 2 fields "Month" and "Year". I would like
to have the month and year inputed through a form and update all the records
in the table. I am okay with the form but I can not get a query to do what I
want. I know this is probably a simple thing but I must be missing
something. Any help would be greatly appreciated.
 
J

Jerry Whittle

First off do NOT create two field for the Month and Year. Instead create only
one field and call it something like ImportDate. Make this field a Date/Time
datatype. In the Default Value of this new field put in the following:

=DatePart("m",Date()) & "/1/" & DatePart("yyyy",Date())

Now when you add a new record, it will put in something like 6/1/2006 which
will be the first day of the month and year.

Having the entire date in a date/time field allows you to use Access' many
powerful date manipulation functions.
 
S

sdesh

Jerry Whittle said:
First off do NOT create two field for the Month and Year. Instead create only
one field and call it something like ImportDate. Make this field a Date/Time
datatype. In the Default Value of this new field put in the following:

=DatePart("m",Date()) & "/1/" & DatePart("yyyy",Date())

Now when you add a new record, it will put in something like 6/1/2006 which
will be the first day of the month and year.

Having the entire date in a date/time field allows you to use Access' many
powerful date manipulation functions.
 
S

sdesh

Thanks for your help. I have 2 questions. Where is the date pulling from or
creating from? Is it the date of the file that I am importing or the present
date. This works except I need to have it for the previous month. For
example: I will run May 31, 2006 information on June 1st or 2nd. I need the
date to be in the file May, 2006. Is this possible to do that?
 
Top