Need to uncheck a checkbox in my form

magster06

Registered User.
Local time
Today, 18:47
Joined
Sep 22, 2012
Messages
235
Hello All,

I have a table "LightDuty" with a field [Email Sent] that is a YES/NO field.

I do not have a checkbox on the main form for the [Email Sent]; instead this field is checked (in the table) when the user sends an email to the receipient. I use the [Email Sent] field as a criteria for my query.

Ok, now what I am looking to do:

I need to uncheck the checkbox when the user changes the date in a field called [Drs Excuse Exp].

This is what I have tried (in the AfterUpdate event of the Drs Excuse Exp control):

Code:
Dim db as DAO.Database
Dim rs as DAO.Recordset
 
Set db = CurrentDb
Set rs = db.OpenRecordset("LightDuty")
 
  With rs
     .Edit
     .Fields([Email Sent]) = False
     .Update
 End With
 
rs.Close
db.Close
 
Set rs = Nothing
Set db = Nothing
 
Exit Sub

I get the runtime error 3265 "Item not found in collection"

Any help would be appreciated.
 
Nervermind, I figured it out.

Sorry!


QUESTION:

Do I have to open the recordset?

Do I have to Set the db?

Is there an easier way to code the above?

Thanks!
 

Users who are viewing this thread

Back
Top Bottom