Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output Answer Based on Query

Status
Not open for further replies.

Tezdread

Technical User
Oct 23, 2000
468
GB
Hi, I've been helped in getting a query to show yes or now based on the criteria specified in a table and I've now been trying various ways of getting this to automatically work on the form so when I finish entering details into the specific fields a text box will display Yes or No.

In it's more simple form this is what I have.

A table [table1] has 5 fields [value1] - [value5] each numerical and in my query I have this statement;

NewField: IIF([value1]>=2 And [value2]>=2 And [value3]<=4 And [value4]>=3 And [value5]>=2,"Yes", "No")

This gives me the expected results when I run the query but how do I get this to automatically update a text box on a form when all the data's been entered?

I've tried using the onFocus, afterUpdate etc but haven't got it working yet so any help would be greatly appreciated.

Tezdread
&quot;With every solution comes a new problem&quot;
 
Have you tried plugging your IF statement into the ControlSource of the text box? You should just be able to use the = sign plus your IIF statement.
 
I've got it working although not sure if it's the best way and I still need to be able to store the "yes" "no" field?

This is what I have so far

In the query I inserted all the fields that are in the iif statement then created the form based on the query. when I now enter the data into the fields all the data except the "yes" "no" field.

I have a field in the table called the same as the one in the query "YNValue" but it seems that because this is calculating the other fields it isn't stored anywhere?

How can I get this value that's generated by the query to be saved in my table?

Tezdread
&quot;With every solution comes a new problem&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top