Re: quick simple question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



hi,

ifoundgoldbug@xxxxxxxxx wrote:
but how do can I access just the first record of field LastEmail using
code?
Guess you have table PM(ID, ..., LastSent:Date/Time).

Dim rs As ADODB.Recordset

Set rs = New ADODB.Recordset

rs.Open "SELECT TOP 1 * FROM PM ORDER BY ID ASC", _
CurrentProject.Connection, adOpenForwardOnly, adLockOptimistic
Debug.? rs![LastSent]
rs.Close

Set rs = Nothing


or

rs.Open "SELECT * FROM PM " & _
"WHERE (Date()-LastSent)>6 " & _
"AND DatePart('w', ExecutionDate) = DatePart('w', Date())", _
CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do While Not rs.Eof
'....
rs![LastSent] = Date()
rs.Update
rs.MoveNext
Loop
rs.Close


mfG
--> stefan <--
.