decision support flag based on mulitple field values

Lifeseeker

Registered User.
Local time
Today, 11:01
Joined
Mar 18, 2011
Messages
273
Hi there,

I would like to create a field for decision support on the mainform.

This field needs to say "top" when other fields in the mainform have values. (texts)

So for example, field A says "Yes", field b says "Yes", and either field C or field D or field E has says "Yes" on this particular record, then I would like to flag this record by having this decision support field say "top".


If someone could point me in the right direction as to which event I should use in order to trigger this automatic input in Access 2003, it would be wonderful.

Thank you
 
If you want it to update as you change the various values, create a function and call it from the after update events of each of the 5 controls.
 
Either the lost-focus or update events of the various controls would give you a decent event from which to work.
 
Either the lost-focus or update events of the various controls would give you a decent event from which to work.

If the condition is such that field A and field B and any one of the field D or E or F has values in them?

Then I would like the decision field to say "top".

How do I reflect the two AndS and two Ors in one query/vba?

Thank you
 
I would not use the lost focus event, as there's no need to fire the code if nothing has changed. Generally

If A And B And (C Or D Or E) Then
 
I would not use the lost focus event, as there's no need to fire the code if nothing has changed. Generally

If A And B And (C Or D Or E) Then

I am sorry but where would you write the code?
Is it in vba module. If so, undress what event shall I write it in?

Or do I write the code in the control source of that decision support field?

Thank you

I am just not sure how to start.
 
Did you miss post 2, where I suggested the after update event? Here's where code would go:

http://www.baldyweb.com/FirstVBA.htm

You could also put an IIf() in the control source of that decision textbox, if you just wanted to display the value (which a good case could be made for). I guess where you should start is deciding whether to save the value or calculate it on the fly.
 
Did you miss post 2, where I suggested the after update event? Here's where code would go:

http://www.baldyweb.com/FirstVBA.htm

You could also put an IIf() in the control source of that decision textbox, if you just wanted to display the value (which a good case could be made for). I guess where you should start is deciding whether to save the value or calculate it on the fly.


If I wanted to store the value, where would I put the vba code in? In the control source?

The code I have written so far in the expression builder of the decision support field on the form is as follows:

If [testA_done].value = "yes" AND [test 2_done].value= "yes" AND ([field A].value = "Yes" OR [field_b].value = "yes" OR [field_c].value = "yes")

then [decision support field].value = "top"

else

[decision support field].value = "down"

When I click ok, the entire code disappears. I wonder if this is because the decision support is an actual field in the table. (not an unbound text-box)

Any comment/feedback much appreciated.
 
VBA code can only go in the VBA editor. It can not go in the expression builder or in the control source. The link I posted and you quoted demonstrates how to get there.
 

Users who are viewing this thread

Back
Top Bottom