JS-Q9 Restricting available options on form, contrasting new record with editing existing record

J

Jack Sheet

Hi all. Access 97.

I have a simple form for the purpose of updating a table, one record at a
time.

I require that one of the text boxes on the form (displaying one of the
fields) should be editable if and only if it is a new record that is being
displayed, but read-only if it is an existing record already saved that is
now being edited.

I suspect that the easiest solution might be to use two separate forms: one
for editing existing records and one for entering new records. Can someone
please confirm which is the correct approach?

Thanks. Please ignore character string JS-Q9 in subject header.
 
T

tina

well, the easiest way (in the long run) is to lock/unlock or hide/unhide the
control in question as appropriate, as you move from record to record. to do
this, add the following to the form's Current event procedure, as

Me!MyControlName.Locked = Not Me.NewRecord

or

Me!MyControlName.Visible = Me.NewRecord

in either case, substitute the correct name of the control, of course. if
you want to also make that particular control "not editable" as soon as a
new record is saved, even when the user does *not* immediately move to
another record, then add the same line of code to the form's AfterUpdate
event, also.

hth
 
D

Douglas J Steele

Jack Sheet said:
Thanks. Please ignore character string JS-Q9 in subject header.

I'm sure you're doing it to make it easier to find your answers. However,
you're using Outlook Express 6.0. If you use Ctrl-H, it will limit the
display to those threads that you've posted anything to.
 
J

Jack Sheet

Oh, ROFL
Thanks, I didn't know.

Douglas J Steele said:
I'm sure you're doing it to make it easier to find your answers. However,
you're using Outlook Express 6.0. If you use Ctrl-H, it will limit the
display to those threads that you've posted anything to.
 
J

Jack Sheet

Thanks Tina, will try it out.

tina said:
well, the easiest way (in the long run) is to lock/unlock or hide/unhide
the
control in question as appropriate, as you move from record to record. to
do
this, add the following to the form's Current event procedure, as

Me!MyControlName.Locked = Not Me.NewRecord

or

Me!MyControlName.Visible = Me.NewRecord

in either case, substitute the correct name of the control, of course. if
you want to also make that particular control "not editable" as soon as a
new record is saved, even when the user does *not* immediately move to
another record, then add the same line of code to the form's AfterUpdate
event, also.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top