Connection String

dccooper
10-05-2000, 01:23 PM
I want to connect a VB form to a MS Access table using ADO and setting the connection string at Form_Load event using with the App.Path syntax so the application can run as a stand-alone.

The only options I can find are:
1.Connect setting everything Programmatically
2.Connect setting everything in advance through the Properties (app.path does not work)

The code Below does not work and I can't understand why?

Private Sub Form_Load()
On Error GoTo Err_Form_Load

Dim strConnection As String

strConnection = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & App.Path & "MudPITVB.mdb"

Me.adProgram.ConnectionString = strConnecction
Me.adProgram.CommandType = adCmdTable
Me.adProgram.RecordSource = "tblprograms"

Exit_Form_Load:
Exit Sub

Err_Form_Load:
MsgBox "Error Number: " & Err.Number & " - " & Err.Description
Resume Exit_Form_Load
End Sub

Please...I know this is probably very basic but I would appreciate any help?

makai
10-09-2000, 03:33 PM
perhaps open might do it

adProgram.ConnectionString = strConnecction
adProgram.CommandType = adCmdTable
adProgram.RecordSource = "tblprograms"
adProgram.Open

dccooper
10-10-2000, 04:27 PM
Thanks, I tried and there is no open method for the ADO data control object. Perhaps I overstated the problem above. I have a stand-alone app and simply want to set the connection string to "app.path" using the ADO Data control. Surely, this control can not be limited to network applications. Thanks for your help.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum