IIF number exists, then subtract

TxSteve

Registered User.
Local time
Today, 15:23
Joined
Dec 28, 2006
Messages
35
(hard being a rookie)

On my Form, I want to have a query look at one specific field for a number (1). If the number is found then I would like to have the query do basic subtraction on two other fields. (one from each table)

What I have so far is one unbound text box with the following,
=IIf(tblDaStrategy!DaNumber=1,(tblDaStrategy!DaTarget-tblDaReport!DaActual1))

Simply put, if one field has the number one in it, then take the other two fields and subtract (ex. 100-75) to display 25.

It's not working. I keep getting the #Name?

Update: I think I got it. I went back to square one and made a master query that contains the data from both tables. Then I bound one of the forms to the query. I updated my IIF statement and poof. It seems to be working. Now, where's the Asprin and my pillow?

Update 2: Bummer, now my magical 25 is in place but now my form is locked tight. Guess I need to consider abandoning this concept and simply producing a report with the 25 on it. Unless someone out there has a better idea.
 
Last edited:
You need to specify the field name in your form. eg:

Me!FieldName or Forms!FormName!FieldName

so try:

=IIf(Me!DaNumber=1,(Me!DaTarget-Me!DaActual1))

BTW I just noticed:

DaTar get

with a space in it. Is this a typo?

Dave
 

Users who are viewing this thread

Back
Top Bottom