Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 DSN less connection for pass through query

Author  Topic 

osupratt
Posting Yak Master

238 Posts

Posted - 2010-04-05 : 18:36:58
I have DSN Less connection code as follows:

Private Sub Form_Open(Cancel As Integer)
' Minimize the database window and initialize the form.

' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.FilterOn = True


Dim ServerName As String
Dim UserName As String
Dim Password As String

ServerName = "CPSHOUDB15"
UserName = "********"
Password = "********"

'Attach the linked database tables if they aren't already attached
AttachDSNLessTable "dbo_MAS_MWS_AR1_CustomerMaster",
"MAS_MWS_AR1_CustomerMaster", ServerName, "MAS_TXD_IMPORT", UserName,
Password

'If CreateDSNConnection("(local)", "pubs", "", "") Then
'// All is okay.
'Else
'// Not okay.
'End If

End Sub

How would I use something like this for a Pass Through query? And where would this be placed? I have a check box on a main data entry form that runs the pass through query. I just need help with the connection staying connected. Any help would be appreciated. Thanks.


   

- Advertisement -