option question

T

tarzan123_us

Hi all,
I have created form with two text boxes. Begining date_______ and End
Date_____
Where I will input dates to see my customers based on this criteria.
Moreover, I have added 2 option buttons. One is > $100,000 and the other
<$100,000

Whick code should I in order to see the report based on the users selection.
I have in miind something like that: if [option1].value = 1 then
(something) >$100,000 else <$100,000.
2. Would I write this code in query?
 
A

Al Camp

Tarzan,
Create a calculated field in your report query...
AmtText : IIF(YourCheckField = 1, "<$100,000", ">$100,000")
 
L

Larry Linson

Greater or less than $100,000 _what_?

Assuming the Query that you use for the RecordSource of the Report has a
corresponding date/time value and a field with the amount in it, you would
use these as Criteria in that Query... if you open the Report with
DoCmd.OpenReport, you'd have a WhereCondition argument something like

strWhereCondition = _
[MyDate] BETWEEN #" & Me!txtFirstDate & _
"# AND #" & txtSecondDate & "# AND [MyAmount] "
If Me!optLow Then
strWhereCondition = strWhereCondition & "<100000"
Else
strWhereCondition = strWhereCondition & "<100000"
End If

MyDate and MyAmount are the Fields in your Table referenced by the Query.
The code would immediately precede the DoCmd.OpenReport statement generated
by the Command Button Wizard.

Larry Linson
Microsoft Access MVP
 

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