By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,518 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,518 IT Pros & Developers. It's quick & easy.

Storing values in fields based on other field with checkbox

P: 14
Hello, I have a field "MappedTo" in a subform "OldCodes" thats needs to refer to a field "NCodes" in the main form "NewCodes" based on whether a field in the subform "Decision" is checked or not. I would like it so when a user clicks the checkbox for "Decision", "MappedTo" is automatically updated with whatever the current "NCode" is in the main form. I can sorta do this by using

IIf([Decision]=-1,Forms!NewCodes![NCodes]," ")

as the control source for "MappedTo", but this gives me a problem. Each "old code" in the subform can possibly map to multiple "new codes" in the main form, but I would like the resulting value from the function to be the same throughout each record, and not recalculated each time it appears. Also I am having trouble storing this value in its underlying table.

In short, I need to know how to store a calculated if-then field to an underlying table, and for the calculation to only be performed on the actual click of the checkbox, not if a checkbox is already clicked or not.

I've messed around with several BeforeUpdate, AfterUpdate, and OnClick codes as well as trying to store in hidden textboxes, but keep getting errors. Please help, thanks to anyone who can.
Jun 30 '10 #1

✓ answered by NeoPa

I suggest you use the Decision_AfterUpdate() event procedure in your sub form to set Me.MappedTo to Me.Parent.NCode.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,768
I suggest you use the Decision_AfterUpdate() event procedure in your sub form to set Me.MappedTo to Me.Parent.NCode.
Jul 1 '10 #2

P: 14
Thanks for the response, I think that might have helped it but I've been given some new requirements and come up with a whole new seperate problem, lol. Thanks for the help though.
Jul 6 '10 #3

NeoPa
Expert Mod 15k+
P: 31,768
No worries :)

If you have a separate problem you may want to post that too.
Jul 6 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.