R
Roderick O'Regan
Microsoft XP Pro - Access 2002
I have a form based on a query (which has calculated fields in it) and
which, in turn, is looking at a linked table ("orders")
From the open form I want to change the value of a checkbox
("OrderInvoiceSignedOff") in the above table from unchecked to
checked.
I have written the following "On Click" event procedure attached to a
command button on the open form in an attempt to achieve this:
stLinkCriteria = Me![txtPO_Nbr]
strSQL = "SELECT * FROM Orders WHERE PO_Nbr=" & stLinkCriteria
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
With rs
.Edit
.Fields("OrderInvoiceSignedOff") = True
.Update
.Close
End With
As soon as the third line is run it gives me the following error:
"Object variable or With block variable not set"
stLinkCriteria is defined as Long
rs is defined as DAO.Recordset, and...
db as DAO.Database
I'm sure the answer is staring me in the face but even after trying a
number of code permutations I still can't get the error to go away.
Can someone spot the glaring mistake in my code, please?
Roderick
I have a form based on a query (which has calculated fields in it) and
which, in turn, is looking at a linked table ("orders")
From the open form I want to change the value of a checkbox
("OrderInvoiceSignedOff") in the above table from unchecked to
checked.
I have written the following "On Click" event procedure attached to a
command button on the open form in an attempt to achieve this:
stLinkCriteria = Me![txtPO_Nbr]
strSQL = "SELECT * FROM Orders WHERE PO_Nbr=" & stLinkCriteria
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
With rs
.Edit
.Fields("OrderInvoiceSignedOff") = True
.Update
.Close
End With
As soon as the third line is run it gives me the following error:
"Object variable or With block variable not set"
stLinkCriteria is defined as Long
rs is defined as DAO.Recordset, and...
db as DAO.Database
I'm sure the answer is staring me in the face but even after trying a
number of code permutations I still can't get the error to go away.
Can someone spot the glaring mistake in my code, please?
Roderick