Link to home
Start Free TrialLog in
Avatar of Brandon_Campbell
Brandon_CampbellFlag for United States of America

asked on

Wrtie protect Access Forms

Is there a way to write protect a form outside of putting the database into a folder that has read only properties. I have several controls that are set at run time. The proble is that the controls are filled by cross tab queries built on temporary tables. When the user completes a task the temporary information is deleted and the cross tab table does not have any data and so the column names are now missing in my controls. The user will now get a message box from Access telling them that a control is missing. I would like to keep the user from saving the form with the rowsource. Is there a way to do this in Access or do I need to protect a folder and link all tables to the database.
Avatar of Eric Sherman
Eric Sherman
Flag of United States of America image

Set the form's Record Source to " " using the Unload or Close Event.

ET
Hi Brandon,

You can set the Recordset Type to Snapshot


Good Luck!

Gary
On the Form property sheet, set the Allow Edits and Allow Additions properties to No.

mx
Avatar of Brandon_Campbell

ASKER

Hi,
Thank you for your responses. I need to control the form not the data. I'm not using the security settings but I do have the folder secured where the database is located. I don't know if any of you have experienced this but when everyone can open the database as admin they have the capability of saving the form with whatever is in the rowsource, controlsource, etc. thus causing grief when a form does not have the correct fields due to contrived field names from dynamic queries. Therefore, if anyone know how to admins from saving the form structure that would be great.

Thank you,
Ok, so you are building the structure of the form dynamically ....  I think that's what's changing/saving the form, not the user.  As long as you set the recordsource of the form when it loads to match the fields you dynamically created then you should be ok.  I would use the form's Load and Close Events as shown below.

Private Sub Form_Load()
     Me.RecordSource = "Your dynamic SELECT Statement Here ............;"
End Sub

Private Sub Form_Close()
     Me.RecordSource = ""
End Sub

ET
The recordsource for the form is fine, the problem exists with a listbox control. I have set the unload event to remove the rowsource and change the rowsourcetype to value list. The problem occurs when a user may use ctrl + s  thinking they are saving the data instead they have saved the settings that populated the controls. I know that I could try trapping for ctrl + s but that will take a bit of programming. The other problem would be if the user selected save from the File menu or selected the save icon. In this case I could me custom menu bars and remove the icon all together but all users use the database as admin and therefore can add the icons back and change the menu bar. I have been restricted from using the security features of Access and I am confronted with probably putting a frontside database into a read only folder and linking to tables in a folder that is not write protected. Please advise if you can think of any other possible solution.

Thank you.
Without seeing your project, I'm not exactly sure of all that you are trying to accomplish ... prehaps there's a different concept that should be considered.

However, from your last comments ... sounds like you will have to use a sequence of temp forms or maybe open the formn in Design mode before closing and basically strip it down since it is being created dynamically each time.

ET
ASKER CERTIFIED SOLUTION
Avatar of Brandon_Campbell
Brandon_Campbell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial