snoopy92211
Technical User
Hi. I have some code that I'm using to update a table in a recordset.
I have this date function.
If the user selects 3/1/06 as a due date, the code creates 11 more records with the same due DAY, different months/years, always starting with february(j) = 1.
That part works fine.
The bolded section is what I'm having a problem with.
If the recorset date( rst.duedate) is less than the original due date (the date the user inputs into the form), I want the obligation field in the recordset to be 'inactive'
Apparently, the less than command doesn't entirely work. I've tried this, and it makes (seemingly) random dates 'inactive.
If user types 3/1/06, 11 records will be created, from 2/1/06 - 1/1/07. What I want to see is the 2/1/06 record marked as inactive, because it's less than the due date.
Make sense? HELP!
Hope so!
Thanks!
I have this date function.
Code:
For j = 1 To 12
Set rst = DB.openrecordset("obligations", dbOpenTable, dbAppendOnly)
rst.AddNew
If j > 1 Then
rst.Fields("DueDate") = CVDate(Str(j) & "/" & Format(Day(DueDate), "00") & "/" & Format(Year(DueDate), "0000"))
Else
rst.Fields("DueDate") = CVDate(Str(j) & "/" & Format(Day(DueDate), "00") & "/" & Format(Year(DueDate) + 1, "0000"))
End If
[b] If rst.Fields("Duedate") < origdate Then
rst.Fields("ObligationStatus") = "Inactive"
Else
rst.Fields("ObligationStatus") = Me.obgstat
End If [/b]
If the user selects 3/1/06 as a due date, the code creates 11 more records with the same due DAY, different months/years, always starting with february(j) = 1.
That part works fine.
The bolded section is what I'm having a problem with.
If the recorset date( rst.duedate) is less than the original due date (the date the user inputs into the form), I want the obligation field in the recordset to be 'inactive'
Apparently, the less than command doesn't entirely work. I've tried this, and it makes (seemingly) random dates 'inactive.
If user types 3/1/06, 11 records will be created, from 2/1/06 - 1/1/07. What I want to see is the 2/1/06 record marked as inactive, because it's less than the due date.
Make sense? HELP!
Hope so!
Thanks!