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", "", "(e-mail address removed)", "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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top