Default value with date field

Rowena

Registered User.
Local time
Yesterday, 19:35
Joined
Jul 16, 2002
Messages
27
Greetings.
I have a database that is supposed to track customers and
the jobs we do for them. I need to set up a form that
will allow for entry of a start date and an end date. To
make data entry easier, I would like the "end date" field
to default to the start date, but I want to be able to
override this as necessary to enter jobs that start and
end on different dates.

How do I do this?

I tried making the end date field equal to the start
field, which defaults correctly, but now it won't let me
over-write with the correct end date for a longer job.

I am using Access 2000 on a Windows 2000 machine, and I have no idea how to write Visual Basic code, so please bear with me.

Thanks for any help you can give me,

Rowena
 
Open the form in design view and right click the StartDate field. Select Properties and click the Events tab. Double click the AfterUpdate event and it puts [eventprocedure] beside it along with a button with three dots in it on the very right-hand side. Click the button with the dots and the module windo opens. Between the lines that start Public Function etc and End Sub put:

Me.[EndDate] = Me.[StartDate]

Replace EndDate and StartDate with the actual names of your fields.

Then it will automatically duplicate the date once the user has filled in the start date but you can still overwrite it if you want to.
 
Last edited:
In the form design mode, click on the Start date textbox, in the properties box, click on the event tab and click on the After Update box. Click the dropdown arrow on the right, select [Event Procedure] and then click on ... to the right of the box. This should open up the code window. Where the cursor is type

Me.NameofEndBox = Me.NameofStartBox

substituting NameofEndBox with the name of the textbox holding the end date and NameofStartBox with the start date textbox name (Note it is not the name of the field)

Close this window and try your form.

Dawn got there first (my fingers must be getting old)
 
Last edited:
re:Value with date field

Thanks much to you both! It seems to actually be working!
Rowena:)
 
Fizzo, great minds etc! :D
 
Or Fools Seldom Differ (but I prefer your analysis):)
 

Users who are viewing this thread

Back
Top Bottom