Hi,
I am trying to connect to SQL server 2000 using an application created as an access data project (*.adp) and deployed with office developer (Clients Access2002 runtime and WinNT/Server SQLServer 2000 and Win2000 server).
The application initally opens the login form and runs code to see if a connection exists; if no connection exists it prompts for UserID and password then runs the code at the bottom of this message. This code works fine from my computer but not on others. (After removing the error handling), I get the err.num -2147467259 ([DBNMPNTW] Could not connect to server). Any guidance anyone could provide on where I could be going wrong would be greatly appreciated. Thanks, Chris
Public intAttempts As Integer
Private Sub cmdEnter_Click()
On Error GoTo ErrorHandler
Dim strConnect As String
Dim num As Integer
'Make sure name is entered
If Nz(Me.UserID, ""
= "" Then
MsgBox "Please enter your UserID"
Me.UserID.SetFocus
Exit Sub
End If
'Make sure password is entered
If Nz(Me.pword, ""
= "" Then
MsgBox "Please enter your password"
Me.pword.SetFocus
Exit Sub
End If
strConnect = "PROVIDER=SQLOLEDB.1;PASSWORD=" & Me.pword & ";PERSIST SECURITY INFO=FALSE;USER ID=" & Me.UserID & ";Workstation ID=" & Environ("ComputerName"
& ";INITIAL CATALOG=Bariatric;DATA SOURCE=xxx.xxx.xxx.xxx,1433"
Application.CurrentProject.OpenConnection strConnect
mdlPatients.MainMenu
Exit Sub
ExitHandler:
If intAttempts = 3 Then
num = MsgBox("Invalid UserID or Password. Registry will be closed. Contact your database administrator for assistance", vbOKOnly, "Bariatric Program Registry"
DoCmd.Quit acQuitPrompt
Else
num = MsgBox("Invalid User ID or Password. Please try again", vbOKOnly, "Bariatric Program Registry"
Me.pword = ""
Me.pword.SetFocus
Exit Sub
End If
ErrorHandler:
intAttempts = intAttempts + 1
Resume ExitHandler
End Sub
I am trying to connect to SQL server 2000 using an application created as an access data project (*.adp) and deployed with office developer (Clients Access2002 runtime and WinNT/Server SQLServer 2000 and Win2000 server).
The application initally opens the login form and runs code to see if a connection exists; if no connection exists it prompts for UserID and password then runs the code at the bottom of this message. This code works fine from my computer but not on others. (After removing the error handling), I get the err.num -2147467259 ([DBNMPNTW] Could not connect to server). Any guidance anyone could provide on where I could be going wrong would be greatly appreciated. Thanks, Chris
Public intAttempts As Integer
Private Sub cmdEnter_Click()
On Error GoTo ErrorHandler
Dim strConnect As String
Dim num As Integer
'Make sure name is entered
If Nz(Me.UserID, ""
MsgBox "Please enter your UserID"
Me.UserID.SetFocus
Exit Sub
End If
'Make sure password is entered
If Nz(Me.pword, ""
MsgBox "Please enter your password"
Me.pword.SetFocus
Exit Sub
End If
strConnect = "PROVIDER=SQLOLEDB.1;PASSWORD=" & Me.pword & ";PERSIST SECURITY INFO=FALSE;USER ID=" & Me.UserID & ";Workstation ID=" & Environ("ComputerName"
Application.CurrentProject.OpenConnection strConnect
mdlPatients.MainMenu
Exit Sub
ExitHandler:
If intAttempts = 3 Then
num = MsgBox("Invalid UserID or Password. Registry will be closed. Contact your database administrator for assistance", vbOKOnly, "Bariatric Program Registry"
DoCmd.Quit acQuitPrompt
Else
num = MsgBox("Invalid User ID or Password. Please try again", vbOKOnly, "Bariatric Program Registry"
Me.pword = ""
Me.pword.SetFocus
Exit Sub
End If
ErrorHandler:
intAttempts = intAttempts + 1
Resume ExitHandler
End Sub