dccooper
10-05-2000, 12: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?
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?