Group: microsoft.public.access.forms
From: "Tony Williams"
Date: Friday, November 16, 2007 11:01 AM
Subject: Re: Datasheet Form problem

Thanks for that. However as I said the control sources for the date and time
are set to default to the system date and time using Date() and Time(). I
would prefer for them to be set when the user starts to enter data not when
the form is opened though?
Any ideas?
Thanks
Tony
"Mark A. Sam" wrote in message
news:Ok%23DSEHKIHA.3916@TK2MSFTNGP02.phx.gbl...
> Tony,
>
> When I first began reading the routine, I thought that you should set
> defaults for those controls, otherwise you would be establishing a new
> recored each time you to to a new record. Set the default values on the
> controls, then when you enter data, the defaults will fill in
> automatically.
>
> God Bless,
>
> Mark A. Sam
>
>
> "Tony Williams" wrote in message
> news:eesf51GKIHA.5860@TK2MSFTNGP04.phx.gbl...
>>I have a subform that is in datasheet format. There are 3 controls
>>ActionDate (Source Date()), ActionTime (Source Time()), and ActionLog
>>(Text field). All 3 fields are locked and have this code in onCurrent
>>event
>> Private Sub Form_Current()
>> If Me.NewRecord Then
>> Me.Action_Date.Locked = False
>> Else
>> Me.Action_Date.Locked = True
>> End If
>> If Me.NewRecord Then
>> Me.Action_Time.Locked = False
>> Else
>> Me.Action_Time.Locked = True
>> End If
>> If Me.NewRecord Then
>> Me.Action_Log.Locked = False
>> Else
>> Me.Action_Log.Locked = True
>> End If
>> End Sub
>> This works fine but the problem is as soon as I start to fill in the
>> latest log a new record is created in the datasheet with today's date and
>> time. This means that the next time I open that subform the date and tme
>> that this empty record was created are already there not the date and
>> time the subform is opened. I think I need it to stop creating a new
>> record automatically but default the date and time when the sub form is
>> opened for input.
>> Anyone help?
>> Thanks
>> Tony
>>
>
>