Updating ADO Recordsets

StryderLlama

Registered User.
Local time
Today, 10:37
Joined
Oct 26, 2007
Messages
19
This is probably very simple but I am no expert in writing VBA by any means, just good at finding code and making it work. I am having trouble though learning how to update results from an ADO recordset. Can someone point me to a place that can help me learn to update the ado recordset. Here's how I do it. When my form opens, the subform connects to the ADO recordset from another access database. It then gets the recordset and sets it to the forms recordset. Now I need users to be able to go through and select several yes/no boxes. When they are done I want to be able to update the original database I connected to to get the recordset and then update the records. Am I going about this the wrong way. I have researched but am at a point where everything is running together. Just need some guidance in where to turn. Thanks. Here is how I am connecting to the recordset.
Sorry, not sure how to make the code look right in this forum.

Private Sub Form_Open(Cancel As Integer)

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

'Use Microsoft Access's OLEDB connection to the Jet database
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
With rs
.Source = "SELECT tblVendorFishing.*, tblVendorFishing.UniqueID AS FR_RECOV_KEY, tblVendorFishing.[MTV/CAS Comments] AS FR_COMMENTS, " & _
"DateDiff('d',[PROCESS_DT],[InitialVendorSetupDt]) AS DaysToSetup, DateDiff('d',[LastModDate],Now()) AS Aging " & _
"FROM tblVendorFishing " & _
"WHERE (((tblVendorFishing.Status) = 'Audit' Or (tblVendorFishing.Status) = 'Pend')) " & _
"ORDER BY tblVendorFishing.[SELECT];"
.ActiveConnection = cn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockBatchOptimistic
.Open
End With
Set Me.Recordset = rs


Set rs = Nothing
Set cn = Nothing
End Sub
 

Users who are viewing this thread

Back
Top Bottom