ms access autoexec
Posted on 2014-10-24
I have a MS Access database. The Office Manager, where the DB is hosted, wants the ability to hide/unide a control on a subform (frmCreditCards). Normally, not a difficult task! However, because the DB is split, I have adopted a script that, when an end user clicks the DB shortcut icon on their respective workstation, the user interface is copied to a local folder on that workstation and the DB opens. This allows me to easily make interface changes and upload the new interface to the server. All the user needs to do is close/open the DB and the changes are there, without interrupting DB activity. This seemed easier than using one of the available split database interface tools that constantly checks and updates the interface...
Herein lies the problem. I have a command button on the "Admin" form (frmAdmin) that, when pressed, toggles a control on a subform (frmCreditCards) of the main form (frmMembers). Here's the code:
Private Sub btnLockDeclined_Click()
On Error GoTo Err_btnLockDeclined_Click
'toggle the control
If Forms!frmMembers!frmCreditCards.Form.cbDeclined.Visible = False Then
Forms!frmMembers!frmCreditCards.Form.cbDeclined.Visible = True
Forms!frmMembers!frmCreditCards.Form.cbDeclined.Visible = False
MsgBox "The Main Member's form must be opened to perform this action..."
This works fine, but because the interface is local on each workstation, the changes only show on the Manager's interface! I have experimented with the AutoExec macro, trying to set the state of the control (cbDeclined) on startup, but this was not successful. The macro cant find the control...
I was thinking of writing the Manager's selection (cbDeclined.visible = true/false) to a text file. Then, when the DB opens, it opens and reads the file, sets the control accordingly, then copies that interface to the end user's workstation...This way would be cool, because the DB control would remain in the last set state...
How exactly to do this? Could spend hours experimenting, but don't have hours! Any suggestions, with code examples are appreciated! Also, can I hide the control without having the Main Member's form open?