problem with forms and queries

G

grantschneider

I have created a form to query some information. I have 4 different
columns that I use and change criteria of by using drop down lists in
a form.

ALL of them work fine except for SVP and I don't know why. The SVP
form field is called Combo91 unlike the rest of them, that is not the
issue. here is my code:


SELECT [Master Sales Forecast].Account, [Master Sales
Forecast].Aircraft, [Master Sales Forecast].SVP, IIf([Master Sales
Forecast].SVP Is Null,0,([svpa]*forms![share comm]!svpa+[svpg]*forms!
[share comm]!svpg+[svpn]*forms![share comm]!svpn+[svpr]*forms![share
comm]!svpr-[vpcom])*forms![share comm]!svpt) AS SVPCom, [Master Sales
Forecast].VP, IIf([Master Sales Forecast].VP Is Null,0,([vpa]*forms!
[share comm]!vpa+[vpg]*forms![share comm]!vpg+[vpn]*forms![share comm]!
vpn+[vpr]*forms![share comm]!vpr)*forms![share comm]!vpt*forms![share
comm]!vps) AS VPCom, [Master Sales Forecast].SC, IIf([Master Sales
Forecast].SC Is Null,0,([sca]*forms![share comm]!sca+[scg]*forms!
[share comm]!scg+[scn]*forms![share comm]!scn+[scr]*forms![share comm]!
scr)*forms![share comm]!SCT*forms![share comm]!sct) AS SCCom, [Master
Sales Forecast].EA
FROM [Master Sales Forecast] INNER JOIN BEShare ON [Master Sales
Forecast].ID = BEShare.ID



WHERE ([Master Sales Forecast].SVP = [Forms]![Share Comm]![Combo91]
OR [Forms]![Card Form]![Combo91] IS NULL)
AND ([Master Sales Forecast].VP = [Forms]![Share Comm]![VP]
OR [Forms]![Share Comm]![VP] IS NULL)
AND ([Master Sales Forecast].EA = [Forms]![Share Comm]![EA]
OR [Forms]![Share Comm]![EA] IS NULL)
AND ([Master Sales Forecast].SC = [Forms]![Share Comm]![SC]
OR [Forms]![Share Comm]![SC] IS NULL);
 
G

grantschneider

To clarify, when I leave the SVP field blank, I can get the correct
results but nothing turns up if I put something into th SVP field.
 
B

Baz

You are referring to two different Combo91's on two different forms ([Share
Comm] and [Card Form]). Is that what you intended?
 

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