View form, but lock editting

M

Marie-Lynn

I have a huge table of contact information. I would like the user to be able
to be able to open the form and immediately make a new entry and I would also
like them to be able to browse the previous entries. So far, this is
MSAccess' default. However, I would like to modify the form so that, when a
use ris browsing forms, the user cannot edit the form, only view it. How can
I do this?

Furthermore - if you could totally be my hero and tell me how to do this - I
would love to incorporate a button that they can press that would unlock the
form so that it CAN be editted. In other words, I am tryign to create a
mechanism so that I form is not accidentally editted. Does anyone know how
to do this?

Thank you so much in advance,
ML
 
K

Krzysztof Pozorek [MVP]

(...)
MSAccess' default. However, I would like to modify the form so that, when
a
use ris browsing forms, the user cannot edit the form, only view it. How
can
(...)

Cite from help:
Private Sub ReadOnly_Click()
With Me!Amount
If Me!ReadOnly = True Then ' If checked.
.Enabled = False ' Disable editing.
.Locked = True
Else ' If cleared.
.Enabled = True ' Enable editing.
.Locked = False
End If
End With
End Sub

Another way is (this method moves focus to 1st record):
Private Sub ReadOnly_Click()
Me.RecordsetType = 2 'Snapshot
End Sub

Back to edit mode:
Private Sub ReadOnly_Click()
Me.RecordsetType = 0 'Dynaset
End Sub

K.P.
www.access.vis.pl
 
M

Marie-Lynn

Hello,

Thank you for taking the time to give me this information. I have tried the
first solution you offered. I created a button and connected the code that
you perscribed here to that button. However, when I try to execute it , I
get an error referencing the word 'amount' in the expression, saying that
Access cannot find the amount that I am referring to. Are you able to tell
what I am doing wrong or do you need more specific information?

Any help you can offer would be greatly appreciated.

Thank you,
ML
 
S

strive4peace

you need to substitute whatever YOU are calling the field or the control
for 'Amount' (and also, 'ReadOnly')

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
M

Marie-Lynn

Okay, that makes sense - too a degree. While I understand 'ReadOnly' is the
button name, is amount the form name? Is the form name the control? If not,
then what is?

Thanks again,
ML
 
S

strive4peace

Hi Marie-Lynn,

Amount would be the Name property of the control you want to change
Enabled and Locked for

ReadOnly would probably be a checkbox or a toggle button

personally, I would not use a checkbox to toggle the ReadOnly status...
the code printed was from Help, but it was just illustrating a point not
a practical use.

I did not see any messages before this so I do not know why you asked
the question

~~~

for better understanding of the basics of Access, read this:

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

Warm Regards,
Crystal



*
:) have an awesome day :)
*
 
M

Marie-Lynn

I think I am catching on. I think what you are saying, then, that if the
FORM is what I want the readonly button to control, then 'amount' would be
'formname'

Sounds right?

thanks again,
ML
 
S

strive4peace

Hi Marie-Lynn

.... no ...

if this is going in the code behind the form, then Access already knows
what form you are referring to ... it will really help you to read
Access Basics -- it is only 100 pages and has lots of screen shots, so
you can print it out, get cozy in your favorite chair, and absorb ;)


Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
M

Marie-Lynn

Hi Crystal,

..... okay....

I will read the document that you have made (I've already printed it out),
BUT if I am still at a loss as to how to close a form to make it read-only -
opurposefully through this damn button - I'LL BE BACK!!!

Thanks for your help,
ML
 
S

strive4peace

Hi Marie-Lynn

Sounds great! Once you have Access Basics under your belt, you will
understand our help a lot better <smile> ... a night of sleep after you
read it will help too -- especially if you make a point to read
confusing sections just before you lay down -- let that "other 90%"
figure it out ;)

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 

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