hey yer barred
Board Regular
- Joined
- Jun 19, 2007
- Messages
- 232
Hi All!
I have this coding beloew that is meant to export some cell values from a spreadsheet to a database....but it does not work.
Private Sub CommandButton1_Click()
I dont have any debug errors....it goes through the code fine...but does not update the database!
As you can see, this is a test piece of coding, just to make sure it works before I make the proper version.
Can anyone help please!
I have this coding beloew that is meant to export some cell values from a spreadsheet to a database....but it does not work.
Private Sub CommandButton1_Click()
Code:
Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sPath As String
Dim sSQL As String
sPath = "J:\My Documents\TestDB's\CreditCare\TestDB4CC.mdb"
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath
db.ConnectionString = sConn
db.Open
sSQL = "SELECT * FROM tblMain"
With rs
rs.ActiveConnection = db
rs.LockType = adLockBatchOptimistic
rs.CursorType = adOpenKeyset
rs.Open sSQL
If rs.EOF = False Then
rs.MoveLast
End If
rs.AddNew
rs!Name = "Test"
rs.Update
rs.Close
End With
MsgBox "Done!", vbInformation, "Test For Credit Care"
db.Close
Set db = Nothing
End Sub
I dont have any debug errors....it goes through the code fine...but does not update the database!
As you can see, this is a test piece of coding, just to make sure it works before I make the proper version.
Can anyone help please!