LaurieHamlin
Programmer
I'm trying to add new records to a subform. The parent has an input box for a date. I successfully get the max date from the existing records. DtDf calculates the difference between the date entered and the max date. If the max date is < the date entered, I want it to add a new record for each date. I took out the 'with RS' to put in debug.print's and it's printing the correct numbers at all 3 spots. The recordset works fine. I can manually add records, but it won't add them for me.
DtDf = DateDiff("d", MxDt, wekend)
Do While DtDf > 0
Debug.Print DtDf prints correct #
Me.[Social Security].SetFocus
datSecondaryRS.AddNew
datSecondaryRS("Social Security"
= Forms![Hours Worked]![Social Security]
datSecondaryRS("Date"
= DateAdd("d", 1, MxDt)
Debug.Print MxDt prints correct date
datSecondaryRS("Code"
= "b"
datSecondaryRS("Hours"
= 7
datSecondaryRS.Update
datSecondaryRS.Bookmark = datSecondaryRS.LastModified
Me.Date.SetFocus
DtDf = DtDf - 1
Debug.Print "Leave ="; DtDf prints correct #
Loop
I'm probably overlooking some silly little thing, but I can't figure out what. Any help would be greatly appreciated.
DtDf = DateDiff("d", MxDt, wekend)
Do While DtDf > 0
Debug.Print DtDf prints correct #
Me.[Social Security].SetFocus
datSecondaryRS.AddNew
datSecondaryRS("Social Security"
datSecondaryRS("Date"
Debug.Print MxDt prints correct date
datSecondaryRS("Code"
datSecondaryRS("Hours"
datSecondaryRS.Update
datSecondaryRS.Bookmark = datSecondaryRS.LastModified
Me.Date.SetFocus
DtDf = DtDf - 1
Debug.Print "Leave ="; DtDf prints correct #
Loop
I'm probably overlooking some silly little thing, but I can't figure out what. Any help would be greatly appreciated.