Changing from a Access created Query to a VBA coded SQL query

G

Guest

I created the following "query" via access, but it won't allow me to add any
more arguments and I desperately need to...can someone please help me get
started coding this in VBA? Here is the current SQL in access.

UPDATE TrackInvoice SET TrackInvoice.FreightCharge =
IIf([ShipViaRate]="FREIGHT
ALLOWED",[FreightCharge]=0,IIf(InStr([ShipViaRate],"C"),[freightCharge]=0,IIf([customerNumber]="MKB001",[RefChg],IIf([customerNumber]="WIS002",[RefChg],IIf([customerNumber]="BAT358",[RefChg],IIf([customerNumber]="BAT002",[RefChg],IIf([customerNumber]="MOO002",[RefChg],IIf([customerNumber]="FIR006",[RefChg],IIf([customerNumber]="SIG003",[RefChg],IIf([customerNumber]="PEG001",[RefChg],IIf([customerNumber]="BAT008",[RefChg],IIf([customerNumber]="MAR066",[RefChg],IIf([CustomerNumber]="BAT149",[RefChg],IIf([CustomerNumber]="STA011",[RefChg],[FreightCharge]))))))))))))));


Thank you for looking!
 
D

Duane Hookom

Have you consider either modeling this with lookup tables or creating a
small public function? Nesting more than 2 IIf()s is more than I would ever
consider in a query or control source or code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top