That would help me if I was using SQL databases.. But I need to know how to edit Microsoft Access Databases with Visual Basic..
My teacher found some stuff that helped.. But he also put us back in a rut..
He wants us to find out if we could use a variable in place of a value.
Public Sub AddData()
Dim oCN As New Connection
Dim oRS As New Recordset
Dim sConnect As String
Dim sSQL As String
Dim sCompanyName As String
sCompanyName = "Microworld"
sConnect = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =h:\visualbasic\database\northwind.mdb;" & "Persist Security Info =false"
sSQL = "INSERT INTO Customers(CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax)" & _
"VALUES ('MWRLD', sCompanyName, 'Bob Jones', 'President', '123 Anywhere Street', 'SomeCity', 'MO', '19346', 'USA', '(222) 555-1212', '(222) 555-1313')"
Set oCN = New Connection
oCN.Open sConnect
oCN.Execute sSQL
End Sub
We want to know if sCompanyName would work as a value..
Can anyone help me with this one?
Enter your message below
Sign in or Join us (it's free).