Question

I've inherited a Access database that is used to import some data in SQL. The MDB opens with a form, in a modal mode: no Access menubar or buttons are visible. I can view the tables with content by using the Visual Studio 'Data Connection' tool, but I cannot see the module's code.

I've looked at this question here, but the answers there aren't really what I need. Is there a way to either force the form to close (and access the modules) or to extract the VBA code ?

[EDIT] I am using Access 2007, not sure what the original developer used.

Was it helpful?

Solution

Hold down the shift key when you open the database. This will prevent it from loading the automatic script it's running and allow you to gain access to the tables, queries, and VBA scripts.

OTHER TIPS

This is a rather long addendum to, or comment on, Michael Todd's reply in response to edosoft's comment.

Rather than choosing to enable the content, check the start-up options (either (file->options->current database->display form) or (tools->start up->display form)) and remove the name of the form, having taken a note, and ensure that Allow Full Menus (same page) is ticked. You may also like to press Alt+F11 to display code, and check that for start-up code, finally, see if there is an AutoRun macro and rename it.

EDIT re Comments

You do not have to open an mdb to change the start-up form, for example, code such as this could be run from another mdb using the full name and path of the mdb you wish to change.

Sub SetStartForm(DBFile As String)
Dim prp As Object
Dim db As Database

Const PROPERTY_NOT_FOUND As Integer = 3270

    Set db = OpenDatabase(DBFile)

    db.Properties("StartupForm") = "(none)" 

    If Err.Number > 0 Then
        If Err.Number = PROPERTY_NOT_FOUND Then
            '' Create the new property, but this is not relevant in this case
         End If
    End If

    db.Close
    Set db = Nothing
    Set prp = Nothing
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top