Thread: date field
View Single Post
  #6  
Old October 23rd, 2006, 08:23 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default date field

There must be a syntax error in what you coded. To break it down:

=DateAdd("ww", 1, DMax("[ScheduleDate]", "SchedulteTable"))

[ScheduleDate] should actually be the name of the date field in the table.
ScheduleTable should be the name of the table.
The DMax function will return the hightest date in the table.
The DateAdd function will add one week to that date.

You can test your syntax in the VBA immediate window by typing in the above
formula with the correct field and table name. Just replace the = with ? so
it will print in the window. Once you get a correct return, you have the
syntax correct and can paste it into the Default Value property of the date
field with the =

I did create a form and test it, so it does work.

"sandrao" wrote:

I tried the suggested example and I got an #Error message.

You understood my question. Yes each new record should appear one week after
the previous entry. Tlhe date field name is txDate and the form is
MainScheduleFrm.

I am not sure what I did wrong but the suggestion did not work. Do you have
any other advise


Thanks
"Klatuu" wrote:

If what you are saying is you want each new record's date to be one week
after the previous records date, you can use the Default Value property of
the date field control. Since I don't know the names of your objects, the
following example uses made up names. Change them to use your names:

=DateAdd("ww", 1, DMax("[ScheduleDate]", "SchedulteTable"))

"sandrao" wrote:

How can I have adate field in a form automatically filled with dates. I have
a scheduling program that schedules events on a weekly basis. The schedule
starts on the first day of the week (vbSunday). I would like to have the date
appear each time a new record is started. The first week would be 15-Oct-06
then when those events are filled in the new record would already have the
date 22-Oct-06. These dates would continue on appearing each time a new
record was started.