G
grantschneider
I have four different types of salesmen, SVP VP SC and EA. For each
sale that is recorded, any combination of these types of salesmen can
be entered in. However, they are not all always part of a sale so
sometimes there are mutiple blank columns in a sale.
I have two problems:
1. I am using a form to query different combinations of sales people.
If I leave the VP, SC and EA fields blank, and try to query just a
specific SVP's sale, I only get back the records where there is a
value in the other three fields. I want to make it so that I can leave
the others blank if I want and search all records of a corresponding
field in the form.
Do I change the criteria or can I create checkboxes to disable the
fields or something?
2. Also, the SVP's are labeled by number. When I search for SVP "1" it
gives me back SVPs 1,10,11,12 and 13 (there are only 13). How do I
change the criteria? In the table where I query from this column is
set as a number, not a string.
This is my SQL Code:
PARAMETERS [Forms]![Card Form]![SVP] Text ( 255 ), [Forms]![Card Form]!
[VP] Text ( 255 ), [Forms]![Card Form]![SC] Text ( 255 ), [Forms]!
[Card Form]![EA] Text ( 255 );
SELECT [Card Sale List].SVP, [Card Sale List].VP, [Card Sale List].[#
of Cards], [Card Sale List].Aircraft, [Card Sale List].[Card Product],
[Card Sale List].[Card Type],
IIf([card type]="Renewal",[# of Cards]*[Points]*0.5,[# of
Cards]*[Points]) AS TCOM, [TCOM]*0.25 AS [SVP Com], [TCOM]*0.75 AS [VP
Com], [Card Sale List].EA, IIf([EA] Is Not Null,25,0) AS [EA Com],
[Card Sale List].SC, IIf([SC] Is Not Null,[TCOM]*0.15,0) AS [SC Com]
FROM [Card Sale List] INNER JOIN [Card Points] ON [Card Sale
List].Aircraft = [Card Points].Aircraft
WHERE ((([Card Sale List].SVP) Like [Forms]![Card Form]![SVP] & "*")
AND (([Card Sale List].VP) Like [Forms]![Card Form]![VP] & "*") AND
(([Card Sale List].EA) Like [Forms]![Card Form]![EA] & "*") AND
(([Card Sale List].SC) Like [Forms]![Card Form]![SC] & "*"));
sale that is recorded, any combination of these types of salesmen can
be entered in. However, they are not all always part of a sale so
sometimes there are mutiple blank columns in a sale.
I have two problems:
1. I am using a form to query different combinations of sales people.
If I leave the VP, SC and EA fields blank, and try to query just a
specific SVP's sale, I only get back the records where there is a
value in the other three fields. I want to make it so that I can leave
the others blank if I want and search all records of a corresponding
field in the form.
Do I change the criteria or can I create checkboxes to disable the
fields or something?
2. Also, the SVP's are labeled by number. When I search for SVP "1" it
gives me back SVPs 1,10,11,12 and 13 (there are only 13). How do I
change the criteria? In the table where I query from this column is
set as a number, not a string.
This is my SQL Code:
PARAMETERS [Forms]![Card Form]![SVP] Text ( 255 ), [Forms]![Card Form]!
[VP] Text ( 255 ), [Forms]![Card Form]![SC] Text ( 255 ), [Forms]!
[Card Form]![EA] Text ( 255 );
SELECT [Card Sale List].SVP, [Card Sale List].VP, [Card Sale List].[#
of Cards], [Card Sale List].Aircraft, [Card Sale List].[Card Product],
[Card Sale List].[Card Type],
IIf([card type]="Renewal",[# of Cards]*[Points]*0.5,[# of
Cards]*[Points]) AS TCOM, [TCOM]*0.25 AS [SVP Com], [TCOM]*0.75 AS [VP
Com], [Card Sale List].EA, IIf([EA] Is Not Null,25,0) AS [EA Com],
[Card Sale List].SC, IIf([SC] Is Not Null,[TCOM]*0.15,0) AS [SC Com]
FROM [Card Sale List] INNER JOIN [Card Points] ON [Card Sale
List].Aircraft = [Card Points].Aircraft
WHERE ((([Card Sale List].SVP) Like [Forms]![Card Form]![SVP] & "*")
AND (([Card Sale List].VP) Like [Forms]![Card Form]![VP] & "*") AND
(([Card Sale List].EA) Like [Forms]![Card Form]![EA] & "*") AND
(([Card Sale List].SC) Like [Forms]![Card Form]![SC] & "*"));