BOF EOF error

I

ifoundgoldbug

This is the code that I am running at form load to check the last time
an e-mail was sent VS the current date and if it is over a week old or
if it monday to send off an e-mail. but every time it runs sucessfully
one time for some reason it wipes my EOF and BOF data any help would be
appreciated.

<code>

Private Sub Form_Load()

Dim saveme As Boolean
Dim LastDate As Date
Dim today As Date
Dim rs As ADODB.Recordset

today = Date

Set rs = New ADODB.Recordset

rs.Open "SELECT pmtable.EmailDate FROM pmtable WHERE
(((pmtable.EmailDate)<Date()))", _
CurrentProject.Connection, adOpenForwardOnly,
adLockOptimistic


LastDate = rs.Fields.Item(0)

If (today - LastDate) > 6 Or Weekday(today) = vbMonday And Not
today = lastday Then
saveme = True
Call SendNotesMail("test", "", "[email protected]", "this is
a test of the automatic PM system", saveme)
rs.Fields.Item(0) = Date
End If

rs.UpdateBatch

rs.Close

Set rs = Nothing





End Sub
</code>
 
I

ifoundgoldbug

i got the problem it was my SQL statement when I changed the date in
teh if statement the statement didn't look for dates including todays
date.

thanks anyways
 
Top