Disable fields in a form on open & enable with button click data e

K

Kelly

I'm new to Access and having problems with code. I have created three forms
to be opened by the switchboard. Once anyone opens the forms they are on the
first record and we are afraid people will overwrite the first entry. I have
two buttons on the first form one for create a new job that sets the form to
add a record and blanks the fields. The other button searches so someone can
find a job they have previously worked on and edit. I would like to know the
syntax or sequence on how to put code to show the form disabled on open. Then
click the create new job button to enable the fields for data entry or click
the search button to find the record and enable the fields for edit. I tried
to enable each text but can not data entry at that point. I have searched
with Live search and still have not found a way to do this. Can someone
please help? or point me in a direction to understand how to input the code.
Kelly
 
T

Tom van Stiphout

On Mon, 8 Jun 2009 13:58:01 -0700, Kelly

To give you a suggestion, put a new button on your form, and in the
Click event write:
Me.AllowEdits = Not Me.AllowEdits

Using this idea you can lock a form, and provide a button for
unlocking it. You could also change the caption of the button to
indicate this:
Me.myButton.Caption = iif(Me.AllowEdits, "Lock", "Unlock")

You can also write a line or two in the Current event of the form
(which happens when user navigates to another record) to go back to
the Locked state.

-Tom.
Microsoft Access MVP
 
K

Kelly

Tom I appreciate the response but I'm really not sure where or how to do
this. I'm sorry for the lack of comprhension but this has been a steep
learning curve to get where I am. I inserted a button and on the properties I
placed what you gave me On Enter for that button and got an error that it
can't find the macro 'Me'. What am I doing wrong. Is there a way you can
explain the code for disabling a form or fields. Then click a button to where
you can data entry like what I first posted. I would be greatly appreciative.
..
Kelly
 

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