form locking

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm not very familiar with Access and yet somehow I was given the
responsibility of creating a database. As much as I've been able to "pick it
up" through other posts and microsoft templates and just pushing buttons,
there's still a few things I can't figure out.

First, I have learned that you must assume the user has no idea what they're
doing. In the form, I want the user to be able to scroll through and look at
records but not be able to change them (a database is only as good as the
information that's in it). I want "create new project", "delete current
project", and "modify current project" buttons so that it is editable but
only if you are intending to edit it. I know that you can lock the fields but
i want a button to unlock them if possible.

Any help here would make my day
Thanks, Katie
 
Hi Katie,

This is possible through changing the Enabled and Locked properties of the
controls through code - but there is an alternative you could consider.

Rather than editing each record "in place" in the list - could you have your
buttons open a popup form which just shows one record? All the fields on
this form would be unlocked.

The code to open the form would look like:

Private Sub btnEdit_Click()
DoCmd.OpenForm "frmDetail", , , "id=" & Me.id, , acDialog
Me.Requery
End Sub

Private Sub btnNew_Click()
DoCmd.OpenForm "frmDetail", , , , acFormAdd, acDialog
Me.Requery
End Sub

You would then have a delete button on the detail form - I think the Access
Wizard will create this for you.

This above assumes "id" is the Primary Key for your table. You might want to
do some more to the detail form - disabling record selectors and navigation
buttons, disabling the right click (so they cannot choose "remove filter"
and browse all records in their unlocked state). You'll probably want a
close button too.

Really hope this helps. If it is imperative that the data is edited in
place then I have accomplished this before so can help with it - but it
takes a lot of work and a lot more code!

Cheers!

Ben.
 
Wow, thank you so much. I had it working another way but it was not very user
friendly. This is exactly what I needed and anyone can figure out how to use
it, Thank you so much!!!
 
This worked like a charm when my form's recordsource was a table but i
created a Query and based the form on it so now it doesn't work anymore. A
query has no primary key so it says it can't find the object 'id'. Anymore
help would be great.
Thanks,
Katie
 
Back
Top