Change value in Check Box after another field is updated

MCLEOD

New member
Local time
Yesterday, 17:03
Joined
Jan 23, 2009
Messages
8
I have a form that's used to ship out barcoded elements.

The Main Form is the transaction information (shipping to/date of etc), and the subform is the list of barcoded element(s) to be shipped (barcode #, media details, check box (indicating the item is out-of-house)).

In the past I've just manually updated the check box after entering the barcode number in the subform; however, I'd like to begin hiding the check box on the form and having it change value (from 0 to -1) for every barcode that's entered onto the shipper. (hopefully this makes sense! :))

I've tried entering the following code into:

Code:
Private Sub barcode_m2m_AfterUpdate()
    Me.ShippedOut.Value = -1
End Sub

But I get a runtime error '3164' - Field cannot be updated. ...and to be honest I'm just shooting in the dark with the code.

Any help would be greatly appreciated.

Thanks!
Matt
 
I'm not sure; but I suspect either the barcode is on the subform and CheckBox is on the main form or vis a versa. Either way the code is essentially correct your just need to correct the reference to ShippedOut dependant on the relative positions (ie. subform v main form) of the two controls.

This link should help you get the correct reference.
 
Hi John. Thanks for the quick response...

Both the barcode and the check box are on the subform. I tried changing the code after looking at the link you posted to: Me!ShippedOut.Value = -1 and had received the same error code.

Any other thoughts?

Thanks.
 
make sure ShippedOut is bound to a data in a table, and not come from an unupdateable query
 
smig has it there - make sure your subform has an updateable record source. See here for things that can make it not updateable.
 
Sure enough, the issue was that is was not an updateable record source. Via your link I discovered this was my issue:

It uses JOINs of different directions on multiple tables in the FROM clause. Remove some tables.

I revised my query join types and everything works now.

Thanks Again!
 
Sparx_ThumbsUp.gif
 

Users who are viewing this thread

Back
Top Bottom