Saving default values

Cgrnc

Registered User.
Local time
Today, 17:52
Joined
Nov 7, 2000
Messages
15
Let me get specific in hopes that I will receive a response on this one!!

I've built a work activity database that tracks the activity of a Traffic division in the city that I work in. It's used primarily for production reporting.

My main form for Sign Making has three subforms on it: Equipment Used, Employee Hours, and Materials Used. Obviously before entering information in any of the subforms, a Sign Making record must exist.

For each Sign Making record I have required that a date is entered. The record is given an ID number automatically. Since the ID number is automatically assigned this field is not enabled (nor is it visible to the user). I have a default of current date in the date field. The only field visible to the user is the date field. Since the date field has a default in it, the next natural step (if using the default) is to move focus to one of the subforms. The database will allow no entry in the subforms because no main record has been saved.

HOW DO I GET THE RECORD TO SAVE SO DATA CAN BE INPUT IN THE SUBFORMS WHEN USING THE DEFAULT DATE??????

If I've been unclear about any of this please, please ask questions.
 
You have to physically enter any value in the main to force the defaults to be recorded I don't think there is anyway to automate this process.
 
Thank you for the response! I guess they'll have to input the date!
 
Academically speaking, could you not set the date when the second box gets focus?

Like:

If IsNull(Me!MyDateField) Then
Me!MyDateField = Date
End if

Just a thought.

Ian
 
Bless you!! I am not a programmer and nor am I an academic thinker apparently!
This was just the ticket and just what I was looking for.
A note to anyone else as new at this as I am: I had to bring focus back to the main form using a DoCmd.GoToControl method within the If statement and used it again to return focus to the Subform after the If statement. If I didn't do this, the record did not save and entry in any other field was not allowed.

All together the code looked like this:

If IsNull(Me!txtDate) Then
Me!txtDate = Date
DoCmd.GoToControl "Comments" End if
DoCmd.GoToControl "Subform"


Thanks again Ian!!
 

Users who are viewing this thread

Back
Top Bottom