Is it VB 6 or VB.NET? I dont see any problem in the code.can someone please help me with the code below, i am getting error "Expected )"
con.Provider = ("Microsoft.Jet.OLEDB.4.0;data source = " & App.Path & "\" & "vbox.mdb";Jet OLEDBatabase Password=qw34;Persist Security Info=False")
Dim ConnectionString As String = String.Empty
Dim WorkingDirectory As String = String.Empty
Dim DataBaseFile As String = String.Empty
WorkingDirectory = System.Environment.CurrentDirectory & "\"
DataBaseFile = WorkingDirectory & "\" & "vbox.mdb"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataBaseFile & ";User ID=;Jet OLEDB:Database Password=qw34;"
Dim Con as New OleDBConnection ( ConnectionString )
Dim ConnectionString As String = ""
Dim WorkingDirectory As String = ""
Dim DataBaseFile As String = ""
Dim Con As ADODB.Connection
WorkingDirectory = App.Path & "\"
DataBaseFile = WorkingDirectory & "vbox.mdb"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataBaseFile & ";User Id=admin;Password=qw34;"
Set Con = New ADODB.Connection
Con.Open ConnectionString
Private Sub CommandButton1_Click()
Dim ConnectionString As String = ""
Dim WorkingDirectory As String = ""
Dim DataBaseFile As String = ""
Dim Con As ADODB.Connection
WorkingDirectory = App.Path & "\"
DataBaseFile = WorkingDirectory & "vbox.mdb"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataBaseFile & ";User Id=admin;Password=qw34;"
Set Con = New ADODB.Connection
Con.Open ConnectionString
.
.
.
End Sub
am getting "User-Defined type not defined"Dude, Replace you code with this one. It should work.
Code:Private Sub CommandButton1_Click() Dim ConnectionString As String = "" Dim WorkingDirectory As String = "" Dim DataBaseFile As String = "" Dim [COLOR=Red][B]Con As ADODB.Connection[/B][/COLOR] WorkingDirectory = App.Path & "\" DataBaseFile = WorkingDirectory & "vbox.mdb" ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataBaseFile & ";User Id=admin;Password=qw34;" Set Con = New ADODB.Connection Con.Open ConnectionString . . . End Sub