M
Misha
Hello,
I am really new to access and I was wondering how to set up a query criteria
so that it takes information from a form and applies it to the query data.
I have created a form that uses a combo box to pick from a selection of
comparison values (ie <,>,=...) and then a control box which allows the user
to enter an amount to format the data in the database based on the selections.
I have been able to do this type of method with dates and going between
date1 and date2, however everytime I write the criteria calling the data from
the form it never works I either get no data back or run time error 2001.
Basicall, to summarize what I need it to do is the user chooses either < or
For example, using the data below if the user picks > from the combo box and
types in 1000 in the control box the reult in the query should be:
ID Field1 Field2 Field3
1 100 100 100
2 250 250 500
Table Combo box:
ID Field1
1 <
2 >
3 =
Table Data
ID Field1 Field2 Field3
1 100 100 100
2 250 250 500
3 500 500 1000
4 1000 1000 2000
5 2000 2000 4000
6 4000 4000 8000
Query
SELECT test.Field1 AS Expr1, test.Field2 AS Expr2, test.Field3 AS Expr3,
test.id
FROM test
WHERE
((([test].[Field3])=IIf([Forms]![junk].[comp]=1,"<"+[Forms]![junk].[Num],">"+[Forms]![junk].[Num])));
Any Suggestions would be greately appreciated,
Misha
I am really new to access and I was wondering how to set up a query criteria
so that it takes information from a form and applies it to the query data.
I have created a form that uses a combo box to pick from a selection of
comparison values (ie <,>,=...) and then a control box which allows the user
to enter an amount to format the data in the database based on the selections.
I have been able to do this type of method with dates and going between
date1 and date2, however everytime I write the criteria calling the data from
the form it never works I either get no data back or run time error 2001.
Basicall, to summarize what I need it to do is the user chooses either < or
button which opens the query in normal view and you can see the filtered list...etc and then types in a number into the control box and clicks the open
For example, using the data below if the user picks > from the combo box and
types in 1000 in the control box the reult in the query should be:
ID Field1 Field2 Field3
1 100 100 100
2 250 250 500
Table Combo box:
ID Field1
1 <
2 >
3 =
Table Data
ID Field1 Field2 Field3
1 100 100 100
2 250 250 500
3 500 500 1000
4 1000 1000 2000
5 2000 2000 4000
6 4000 4000 8000
Query
SELECT test.Field1 AS Expr1, test.Field2 AS Expr2, test.Field3 AS Expr3,
test.id
FROM test
WHERE
((([test].[Field3])=IIf([Forms]![junk].[comp]=1,"<"+[Forms]![junk].[Num],">"+[Forms]![junk].[Num])));
Any Suggestions would be greately appreciated,
Misha