Locks records in access database

Asked By 10 points N/A Posted on -
qa-featured

How can you lock records in MS Access database once you update it? And how will you set up the user interface to include only the form you would like for the user to complete?

Thanks,

Renato

SHARE
Answered By 0 points N/A #99380

Locks records in access database

qa-featured

Hi,

Yes, you can lock record in the Access database using some VBA code in a form’s OnCurrent event. You can make a field in the table called “ISLOCKED”. After that in the OnCurrent event code is:

IF ISLOCKED THEN

       FORM1.ALOOWEDITS =TRUE

ELSE

       FORM1.ALLOWEDITS = FALSE

END IF

You may also want to set ALLOWDELETIONS too.

If you want to allow the users to see only some textboxes of the form, you need to make then visible or invisible.

IF ISLOCKED THEN

       FORM1.ALOOWEDITS =TRUE

       FORM.TEXTBOX1.VISIBLE = TRUE

ELSE

       FORM1.ALLOWEDITS = FALSE

       FORM1.TEXTBOX1.VISIBLE = FALSE

END IF

Let me know if you have any other questions or comments.

Thanks.

Related Questions