View Full Version : DAO recordset updating to NULL


PeterOC
12-12-2007, 10:47 PM
I'm a novice working with DAO and have a question that's been baffling me for most of the day.

A recordset is opened that is based on a table (On SQL Server) with default values (0) for the fields Day1, Day2, Day3 etc

But when looping through these fields they initially come up as Nulls so on the first iteration the calculation equals Null when it should be a value. Is there any way to get around this?

I'm running Access 2003 & SQL server 2000

Below is a portion of the code

Set rst2 = CurrentDb.OpenRecordset("tblTimeSheet", dbOpenDynaset)
With rst
Do Until .EOF
'some other code here...
Select Case Format(!OperationDate, "w", vbMonday, vbFirstJan1)
Case 1
rst2!Day1 = rst2!Day1 + !OperatorHours
Case 2
rst2!Day2 = rst2!Day2 + !OperatorHours
Case 3
rst2!Day3 = rst2!Day3 + !OperatorHours
Case 4
rst2!Day4 = rst2!Day4 + !OperatorHours
Case 5
rst2!Day5 = rst2!Day5 + !OperatorHours
Case 6
rst2!Day6 = rst2!Day6 + !OperatorHours
Case 7
rst2!Day7 = rst2!Day7 + !OperatorHours
End Select
rst2.Update