View Full Version : IIf statement in a text box


Robert C
07-31-2000, 07:30 AM
I'm having trouble getting a calculated control to work.

I have an Order Details sub form (on an Orders main form) with a text box which calculates sales tax. It only need apply to those suppliers registered for the tax. Their registration is recorded in a check box on a separate suppliers form - feeding a suppliers table. However this form probably won't be open when the order is being entered. Does anyone know what the coding for this operation would look like.

Any help would be gratefully received.

Many thanks

Neal
07-31-2000, 09:56 AM
It sounds like you need to look up the value of the checkbox using Dlookup. You might be able to build it into your Iif statement, or you could establish a variable for it. It would read something like this:

dim IntChk as integer
Intchk = Dlookup ("[CheckBox]", "TableName", "[SupplierID]" = forms!thisform!SupplierID)

Then your Control Source could reference the variable in the Iif statement.

I haven't tried this. I hope it works.

Pat Hartman
08-01-2000, 06:44 PM
Change the recordsource of the subform to include a join to the Orders table to obtain the tax status indicator. DLookups are slow and joins are more efficient.