Sorry to leave everyone hanging :p
Sorry Shadowfyr, Nick is indeed correct in his interpretation of what I am looking for. The code posted: sub AddRecordTable (first, last, phone, notes)
dim db
Set db = CreateObject ("ADODB.Connection")
' Open the connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\mushclient\mydb.mdb"
db.Execute "INSERT INTO Contacts (FirstName, LastName," & _
"Phone, Notes) VALUES (" & _
"""" & first & """, " & _
"""" & last & """, " & _
"""" & phone & """, " & _
"""" & notes & """ );"
db.Close
Set db = Nothing
end sub
This works fine for an access database, but my database is a MySQL database, so the Provider and Data Source would be different. I have seen this done for SQL Server [Although this is another MS product], so maybe it can't be done with MySQL and I will just have to make do with what I have.
Just had a look around there and according to a post on Experts exchange you can only access SQL Server, Jet and Oracle via DSNless connections.
[e.g. ConnStr = "driver={SQL SERVER};server=localhost;uid=user;pwd=pass;database=somedatabase" ]
Thanks anyway guys! :) |