Search code examples
vbams-accessms-access-2010

Access button feature lost after splitting


I created an access database that had multiple menus forms, some of which only linked to other menu forms. For Example i have a main menu form, on this form i have a button to take you to the ATL Menu form. On this ATL Menu form i have an event procedure in the on load event of the property sheet (Code shown below); the purpose of this is to prompt the user for a password to allow entry, as i only want certain users to have access and im not worried about anyone knowing how to circumvent this method of form protection.

I finished a draft version of the database and decided to test out splitting the database to see what issues would occur, if any. What i encountered was that this password protection event seemed to either disappear or became disabled in some way and i am unsure as to why this has occurred, how to either solve it, or fix it prior to splitting. This has occurred for all areas of the database where i use this form of password protection

FYI: I have a backup of the database that i made prior to splitting, and the password shown in the code below will not be the final password when in use.

The code for the password protection is:

Private Sub Form_Load()

Dim PassWord As String
PassWord = InputBox("Enter Password")
If PassWord = "ITRK" Then
' Open Form
Exit Sub
Else
MsgBox ("You are not authorized to open this form, please see Persons Name")
DoCmd.Close acForm, Me.Name
End If

End Sub

I've seen other posts suggest going to the VBA interface of the new front end, going to Debug an compile database. However i am unable to select this as it is dulled out and not selectable; please see image below:

NoCompileDB

Any help would be greatly appreciated. If anything else is required from me to aid you in helping me please let me know and i will provide what i can.

Kind Regards, Ben


Solution

  • I'm not entirely sure why the issue occurred but i found a solution to my specific issue.

    The steps i followed were:

    1. Compiled the VBA code in the VBA editor
    2. Compacted and repaired the database
    3. Closed and reopened the database
    4. Followed the split procedure as previously done

    This solved my issue of the code loss. I didn't do this before my initial split attempt so maybe that is a required step i missed.

    Regardless, my issue is now solved.

    Kind regards, Ben