Why doesn't my recordset return the updated values? Everytime I add, update or delete a record and requery the recordset, it always returns the original values that does not reflect the new changes. How do I solve This? Please Help! :afrog:
Printable View
Why doesn't my recordset return the updated values? Everytime I add, update or delete a record and requery the recordset, it always returns the original values that does not reflect the new changes. How do I solve This? Please Help! :afrog:
Would .Refresh work?
tried it but same result. I'm using vb6 and ms-access as the database
Here's the code on how is connect and get the recordset
VB Code:
Option Explicit Public conDB As New ADODB.Connection Public adoCom As New ADODB.Command ----------------------------------------------------------------------------------- Public Function openConnectionDB(connection_string As String) As Boolean conDB.ConnectionString = connection_string conDB.Mode = adModeUnknown conDB.CursorLocation = adUseClient conDB.ConnectionTimeout = 1 On Error GoTo ConnectionFailed conDB.Open openConnectionDB = True Exit Function ConnectionFailed: MsgBox Err.Description, vbCritical openConnectionDB = False End Function ----------------------------------------------------------------------------------- Public Function getRecordset(SQLQuery As String) As ADODB.Recordset On Error GoTo GetRecordsetFailed Dim rs As New ADODB.Recordset If (rs.State = 1) Then rs.Close End If Set rs.ActiveConnection = Me.conDB rs.CursorLocation = adUseClient rs.CursorType = adOpenForwardOnly rs.CacheSize = 50 rs.LockType = adLockOptimistic rs.Source = SQLQuery rs.Open Set getRecordset = rs Exit Function GetRecordsetFailed: Set getRecordset = Nothing MsgBox Err.Description, vbCritical Exit Function End Function