Continue Code After FollowHyperlink

mistera

Registered User.
Local time
Today, 10:13
Joined
Jan 3, 2012
Messages
43
My application includes a main menu with an On Open event that ensures that the user's ODBC data source is set up properly to access the SQL Server database where the data is stored. If the ODBC data source needs to be set up, I open a form that emulates a msgbox that includes a "hyperlink". The "hyperlink" is really just a label field with underlined blue font to look like a hyperlink field.

If the user clicks the label field, I have code in my On Click event for the label as follows:

Code:
Private Sub lbl_ODBCLink_Click()
' Purpose: Add ODBC data source for SQL Server database.
    On Error Resume Next
    FollowHyperlink "\\itanas02pr\shared\Five Year Planning\Add ODBC DataSource for SQL.reg"
    If Err.Number <> 0 Then
        Application.Quit
    End If
    On Error GoTo 0
    DoCmd.Close acForm, "frm_MissingODBCMessage"
End Sub

The .reg file sets the registry keys for the data source. The FollowHyperlink code seems to work just fine.

However, it seems that the application gets stuck following that command. In other words, from the user point of view, the form is still visible and doesn't close, nor does the application quit.

If I set a breakpoint in my code at the error number check line, the code stops there and then I can run the rest of the code and it works perfectly -- either quitting the application or closing the form and continuing with my main menu's On Open event.

How can I get my code to continue without me having to force it through?
 

Users who are viewing this thread

Back
Top Bottom