J G
asked on
update query
Ok,
I have 5 fields I want to update if a checkbox is checked. Not sure if I should actually update the records in VBA or if I should use a query that is invoked in vba What would be the better practice? If in VBA what would the syntax be?
basically the update query would be like this:
If I do it all in VBA:
if check box is checked
update field 1 where tbl_store_Item.plu=tble_It em.PLU
If I use a query vba would be:
if check box is checked
run field1.query
I have 5 fields I want to update if a checkbox is checked. Not sure if I should actually update the records in VBA or if I should use a query that is invoked in vba What would be the better practice? If in VBA what would the syntax be?
basically the update query would be like this:
If I do it all in VBA:
if check box is checked
update field 1 where tbl_store_Item.plu=tble_It
If I use a query vba would be:
if check box is checked
run field1.query
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In regards to Pats comment, this is a continuous form. so me.fld1 is dependent upon criteria where where tbl_store_Item.plu=tble_It em.PLU
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the AfterUpdate event of the checkbox:
If Me.chkyourfirld = True Then
Me.fld1 = "something"
Me.fld2 = "something"
....
Else
Me.fld1 = Null
Me.fld2 = Null
....
End If
Never run an update query to update the record you are sitting on. You'll get conflict error messages if the current record is dirty when you run the update query so that will force you to save the current record first before running the update query and that means that you have to save an incomplete record and that could impact your validation. Just don't do it.