how can I lock date field with date(), though it auto. generates current
date, still user can change it
used below
Me!dateenter.Locked = Not IsNull(Me!dateenter)
gives me error
plz advise
thanks
>how can I lock date field with date(), though it auto. generates current
>date, still user can change it
[quoted text clipped - 3 lines]
>
>gives me error
Which error?
Where is that line?
I think that line should be ok, if it is placed in the
Form's Current event procedure.
BUT, why not just set the text box's Locked property in
design view? As Allen said in your other thread, the date
value would be set by using the table field's DefaultValue,
so there is no reason for the bound text box on the form to
be unlocked.

Signature
Marsh
MVP [MS Access]
Gerald - 29 Nov 2005 04:48 GMT
it gives me the error as below
run-time error 2166
You can't lock a control while it has unsaved changes
when - while trying the change the date from dateenter which has Date() in
table design date enter field
purpose is I don't want users to alter the dateenter field
thanks
> >how can I lock date field with date(), though it auto. generates current
> >date, still user can change it
[quoted text clipped - 14 lines]
> so there is no reason for the bound text box on the form to
> be unlocked.
Marshall Barton - 29 Nov 2005 13:39 GMT
Did you try trmoving that line of code and setting the text
box's Locked property in design view?

Signature
Marsh
MVP [MS Access]
>it gives me the error as below
>run-time error 2166
[quoted text clipped - 21 lines]
>> so there is no reason for the bound text box on the form to
>> be unlocked.
Gerald - 30 Nov 2005 04:04 GMT
well, no.
in table design I have a date field with Datefunction
and in form design under the control source of Date field I have this below
code
Me!dateenter.Locked = Not IsNull(Me!dateenter)
date does auto. generates, but only gives me the below error while trying to
change the date
thanks
> Did you try trmoving that line of code and setting the text
> box's Locked property in design view?
[quoted text clipped - 23 lines]
> >> so there is no reason for the bound text box on the form to
> >> be unlocked.
Marshall Barton - 30 Nov 2005 06:11 GMT
That would make no sense in the control source. If you
really need to use that line of code, then it would go in
the Form's Current event procedure.

Signature
Marsh
MVP [MS Access]
>well, no.
>
[quoted text clipped - 34 lines]
>> >> so there is no reason for the bound text box on the form to
>> >> be unlocked.
Gerald - 30 Nov 2005 05:52 GMT
thanks, Marshall problem resolved..
appreciate it.
> Did you try trmoving that line of code and setting the text
> box's Locked property in design view?
[quoted text clipped - 23 lines]
> >> so there is no reason for the bound text box on the form to
> >> be unlocked.