What table? All the above code does is establish a connection to the database.
Here is some code to connect and then update a table
Private hDB As New ADODB.Connection
Private rsData As New ADODB.Recordset
Private Function ConnectDB() As Boolean
Dim sTmp As String
sTmp = "C:\myDBase.mdb
On Error GoTo ErrHnd
hDB.ConnectionString = sTmp
hDB.Mode = adModeReadWrite
hDB.Open
If rsData.State = adStateOpen Then
rsData.Close
End If
With rsData
.ActiveConnection = hDB
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "myTable"
End With
Do Until rsData.EOF
rsData("myField" = "Changed Value"
rsData.MoveNext
Loop
rsData.Close
ConnectDB = True
Exit Function
ErrHnd:
MsgBox Err.Number & " " & Err.Description & " Error Generated By " & Err.Source, vbCritical, "System Error Trap !"
ConnectDB = False
End Function
myDBase.mdb is The Access db Name
myTable is a Table in that db
myField is a Column in that table
Hope this helps Anything is possible, the problem is I only have one lifetime.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.