Avoid logon dialog to connect to SQL 2005

  • Thread starter Gabriele Bertolucci
  • Start date
G

Gabriele Bertolucci

I have the following problem with Access XP and SQL 2005 Express Edition:
i would like to avoid visualization of Access default logon dialog when I
open my ADP procedure.

I've read the following MS article:

ACC2000: Access Project Prompts You to Log On Even Though "Blank Password"
Check Box Is Selected (Q202615)

Obviously I have my custom logon form.
ADP project has a form (a switchboard) which is opened at startup (after
user authentication) and is closed only when application quits.
Here is the Form_Unload event code for the switchboard:

Private Sub Form_Unload(Cancel As Integer)
On Error GoTo Form_Unload_Err
If MsgBox("Do you want to close the application?", vbYesNo + vbQuestion,
"Closing application") = vbYes Then
' Application.CurrentProject.CloseConnection
Application.CurrentProject.OpenConnection ""
Application.Quit
Else
Cancel = True
Exit Sub
End If

Form_Unload_Exit:
Exit Sub

Form_Unload_Err:
MsgBox Err.Description
Resume Form_Unload_Exit
Resume
End Sub

Unfortunately I'm receiving the following error:

"Method 'OpenConnection' of object '_CurrentProject' unsuccessful" (I translated
from italian, so may be something like this)

I tried to uncomment the linke of code with the CloseConnection, but unsuccessfully.
I tried to edit the line of code with the OpenConnection, passing no parameters,
but unsuccessfully too.

I would not think the problem is related to SQL 2005 Express Edition.

Who know most, please lift his hand and speak up!!! I would like it very
much :)
 
G

Gabriele Bertolucci

Finally I got a solution.

Thanks a lot to Giorgio Rancati (italian MVP) who led me to the right code
line!!!!
Many thanks Giorgio!!!

The secret was to unbind the form from the server, with the following code
in the Form_Unload:

Me.RecordSource= ""
Application.CurrentProject.CloseConnection
Application.CurrentProject.OpenConnection ""

Again, very very very many thanks to Giorgio for the help he gave me.
Giorgio, God bless you!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top