IIf statement in a text box

Robert C

Registered User.
Local time
Today, 23:44
Joined
Mar 27, 2000
Messages
88
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
 
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.
 
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.
 

Users who are viewing this thread

Back
Top Bottom