View Single Post
Old February 15th, 2004, 11:22 PM
chacquard chacquard is offline
Authorized User
Join Date: Feb 2004
Location: , , Canada.
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default Update table with a recordset - help!!!


I need help and I have no experience with recordsets.

I want to update a table after a specific report is printed. The report is generated on a click event. It is based on several tables. The main one has a yes/no field with a default value to yes (checked box). All the records with a value of yes in this field are printed. I actually print 1 enveloppe per record.

After the enveloppes are printed, I want to change the value of the yes/no field to NO (or unchecked).

Here is the VB code I did:

    Dim stDocName As String
    Dim db As Database
    Dim rec As Recordset
    Dim strmsg As String

    stDocName = "Enveloppes"
    DoCmd.OpenReport stDocName, acNormal

    Set db = CurrentDb()
    Set rec = db.OpenRecordset("Req_EnveloppesSelection", OpenDynaset)

    Do Until rec.EOF
        Print = 0


For some reason, the table is not updated. I checked if the recordset is updatable (if rec.updatable = true then...) and ran the code step by step. The record is updatable but is not updated. Please help me...