C
canmex
Guest
I would love if someone could help me out. What I would like to do if possible is reference a text string in a IIF function within a query.
This is what works for me.
PriceUSDCode: IIf([Invoicebody].
This is what works for me.
PriceUSDCode: IIf([Invoicebody].
Code:
="536" Or [InvoiceBody].[Code]="537",([PriceUSD]*0.8),[PriceUSD])
What I would like is this.
PriceUSDCode: IIf([forms]![menu]![DiscountString],([PriceUSD]*0.8),[PriceUSD])
The text box [DiscountString] would hold the string that could be changed thus having this applied in my query.
I may be going about this in the wrong way so if you have any suggestions. Any help would be greatly appreciated.
here is the complete complete SQL
SELECT Invoices.WorkOrderNo, Invoices.CustNo, Invoices.DateIssueSOR, Invoices.Exchange, Invoices.InvPaid, Invoices.invwotype, Customers.NAME, [sorprifix] & "-" & [SOR] & "-" & [SORext] AS SORNo, InvoiceBody.InvoiceNumber, InvoiceBody.QTY, InvoiceBody.PriceUSD, InvoiceBody.Code, IIf([Invoicebody].[code]="536" Or [InvoiceBody].[Code]="537",([PriceUSD]*0.8),[PriceUSD]) AS PriceUSDCode, InvoiceBody.CostCenter, Round([invoicebody].[qty]*[PriceUSDCode],2) AS ExtUSD, Invoices.DollarInvoice, IIf([Invoices].[DollarInvoice]="1",Round([PriceUSDCode]*[forms].[menu].[TipoDeCambioAnt2],2),[PriceUSDCode]) AS PricePesos, Round([PricePesos]*[invoicebody].[QTY],2) AS ExtPesos, Invoices.SOR, IIf(IsNull([code])=True,"",[code] & "-" & [CostCenter]) AS codigo, IIf([dollarInvoice]="1",[extUSD],0) AS USD, IIf([dollarInvoice]="2",[extPesos],0) AS MN
FROM ProgramParamiters, (Invoices INNER JOIN Customers ON Invoices.CustNo = Customers.CustomerNum) INNER JOIN InvoiceBody ON Invoices.WorkOrderNo = InvoiceBody.InvoiceNumber
WHERE (((Invoices.DateIssueSOR)<=[forms]![menu]![AntigDate2]) AND ((Invoices.InvPaid)="1") AND ((Invoices.invwotype)="WO") AND ((InvoiceBody.QTY) Is Not Null))
ORDER BY InvoiceBody.Code;