Need to change form from read to update mode

E

Eric Z.

I’m still pretty new at this so please be kind.
I have the form set to read by setting ‘AllowEdits’ = No. This will keep the
data integrity and still allow searching of records.

Only a few people are allowed to edit the data so I need to setup a button
or something with a password to flip the switch to ‘AllowEdits’ = YES. – Is
this the correct way or should I be doing something else.

Can someone please provide an easy way to perform this task, If possible
step by step Please be kind I don’t know any VB.

Thank you in advance.
 
J

Jeanette Cunningham

Hi Eric
you can code a button like this:
On its click event

Private Sub BtnName_Click
Me.AllowEdits = True
End Sub


Note: replace BtnName with the name of your button.
Give it a try and post back if you have more questions.

Additionally set the form to read only each time it moves to a different
record.
In the form's current event put code like this:

Private Sub Form_Current()
Me.AllowEdits = False
End Sub



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
E

Eric Z.

Jeanette
First of all thank you for your response. This is not rocket science but I
failed this is what I have attempted to do.

Within the forms property I have AllowEdits’ = No.
I then added a button and on the property sheet in the tab Event on line
CLICK ON I clicked on the … on the right and selected Expression Builder then
pasted in the following.

I did name the button Update-Hardware-Button.

Private Sub Update-Hardware-Button_Click
Me.AllowEdits = True
End Sub

Saved the form and opened it to receive the following error.
Microsoft Office Accss can’t find the object ‘Private Sub Form_Current() Me.’

If “Privat Sub form_Currnt()
Me’ is a new macro or macro group. Make sure you have saved and that you
have typed its name correctly.


EZ
 
E

Eric Z.

Jeanette,

I will check for your reply Monday Morning (I'm in Phoenix Arizona)
Thank you again
EZ
 
J

Jeanette Cunningham

To fix this error
Microsoft Office Accss can't find the object 'Private Sub Form_Current() Me.'

Open the form in design view then open the code window.
Find the line that says
Private Sub Form_Current() Me

Delete the 'Me' bit and then find Debug on the menu at top of the code
window.
Click Debug and select the compile option.
Fix any errors that are highlighted when the compile finishes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
E

Eric Z.

Thank you,

The error from the Debug shows the following.

Member already exists in an object module from which this object module
derives.

Would you allow for me to email you a small ZIP of the DB if so please
respond to (e-mail address removed)

Best Regards
EZ
 

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