Forums

This topic is locked

DateDiff in Dreamweaver Recordset

Posted 07 Jan 2007 23:35:09
1
has voted
07 Jan 2007 23:35:09 Ed Stewart posted:
Dreamweaver 8.02, ASP/VBSCRIPT/Access
I need to filter my recordset, selecting only the records where LastPmtDate is the previous month. In the Recordset Dialog Box, I have:
<b>SELECT LastPmtDate FROM Tablename WHERE varDateDiff = 1</b>

I have defined the variable:
<b>Name: varDateDiff
Type: Numeric
Value: DateDiff("M",Recordset1.Fields.Item("LastPmtDate".Value,Date)
Default value: 1</b>

Testing the recordset with Dreamweaver's TEST button shows EVERY record in the db.

The error thrown in IE is:
<b>Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/untitled.asp, line 6</b>

The relevant lines are:
<b>4 - Dim rsRecordset1__varDateDiff
5 - rsRecordset1__varDateDiff = "1"
6 - If (DateDiff("M",rsRecordset1.Fields.Item("LastPmtDate".Value,Date) &lt;&gt; "" Then
7 - rsRecordset1__varDateDiff = DateDiff("M",rsRecordset1.Fields.Item("LastPmtDate".Value,Date)
8 - End If</b>


Can someone get me on the right track?
Thanks!

Reply to this topic