Opening up the same table twice, it is not updating

NateofMT

New Member
Joined
Jul 11, 2002
Messages
13
I have a function that opens up a table named JobTable - here is the code for opening the table:

Set rsa = dbs.OpenRecordset("Job_Table", dbOpenDynaset)

That function calls a procedure (while rsa is still open):

Public Function dhAddWorkDaysWoodPrep(lngDays As Long, _
Optional dtmDate As Date = 0, _
Optional adtmDates As Variant) As Date

Dim rs As DAO.Recordset
Dim lngCount As Long
Dim dtmTemp As Date

Set dbs = CurrentDb()
Set rs = dbs.OpenRecordset("Job_Table")
If dtmDate = 0 Then
dtmDate = Date
End If
dtmTemp = dtmDate
For lngCount = 1 To lngDays
dtmTemp = dhNextWorkdayA(dtmTemp, adtmDates)
Next lngCount
With rs
.Edit
rs![WoodPrepCompletionTarget] = dtmTemp
End With
rs.Update
rs.Close
Set rs = Nothing

End Function

--------

The problem I am having is that the Job_Table that is not receiving the updated value for the field WoodPrepCompletionTarget, even though the line rs![WoodPrepCompletionTarget] = dtmTemp has the correct value (I have verified that while I am debugging.)

Is this because the table is already opened by the Function or what am I missing?

Thanks,
Nateofmt
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Dunno, but instead of opening 2 Recordsets, why not make the second instance a RecordSetClone? That should allow you to do your comparison and write to the first instance.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,938
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top