wildcard

S

sam

I have a form with an option group. Allocated, Unallocated, all
In the table/query I have a corresponding field with either Allocated=1 or
Unallocated=2.
I want to report on Allocated, unallocated and All depending on the option
group choice. Setting the criteria for Allocated (1) or Unallocated (2) is
easy enough but I can't work out how to report on all, since 'All' = 3 in the
option group and obviously the field contains 1's or 2's. I'm wondering if
there is a wildcard I can use to show all or some other method?
 
D

Duane Hookom

If the [Corresponding Field] is in the record source of the report then I
would use code like:

Dim strWhere as String
strWhere = "1=1 "
Select Case Me.[optGroup]
Case 1, 2
strWhere = strWhere & " AND [Corresponding Field]=" & Me.[optGroup]
End Select
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
 
S

sam

I'm not sure I completly follow either replies. What i hoped to do was just
to have something like [Forms]![myform]![optiongrp] in the report criteria
--
Thanks


Duane Hookom said:
If the [Corresponding Field] is in the record source of the report then I
would use code like:

Dim strWhere as String
strWhere = "1=1 "
Select Case Me.[optGroup]
Case 1, 2
strWhere = strWhere & " AND [Corresponding Field]=" & Me.[optGroup]
End Select
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


sam said:
I have a form with an option group. Allocated, Unallocated, all
In the table/query I have a corresponding field with either Allocated=1 or
Unallocated=2.
I want to report on Allocated, unallocated and All depending on the option
group choice. Setting the criteria for Allocated (1) or Unallocated (2) is
easy enough but I can't work out how to report on all, since 'All' = 3 in the
option group and obviously the field contains 1's or 2's. I'm wondering if
there is a wildcard I can use to show all or some other method?
 
S

sam

Thanks all, have worked out a way to do it... I think

Like IIf([Forms]![MyForm]![OptionGrp]=3,"*",[Forms]![MyForm]![OptionGrp])
--
Thanks


Duane Hookom said:
If the [Corresponding Field] is in the record source of the report then I
would use code like:

Dim strWhere as String
strWhere = "1=1 "
Select Case Me.[optGroup]
Case 1, 2
strWhere = strWhere & " AND [Corresponding Field]=" & Me.[optGroup]
End Select
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


sam said:
I have a form with an option group. Allocated, Unallocated, all
In the table/query I have a corresponding field with either Allocated=1 or
Unallocated=2.
I want to report on Allocated, unallocated and All depending on the option
group choice. Setting the criteria for Allocated (1) or Unallocated (2) is
easy enough but I can't work out how to report on all, since 'All' = 3 in the
option group and obviously the field contains 1's or 2's. I'm wondering if
there is a wildcard I can use to show all or some other method?
 
M

Marshall Barton

sam said:
I have a form with an option group. Allocated, Unallocated, all
In the table/query I have a corresponding field with either Allocated=1 or
Unallocated=2.
I want to report on Allocated, unallocated and All depending on the option
group choice. Setting the criteria for Allocated (1) or Unallocated (2) is
easy enough but I can't work out how to report on all, since 'All' = 3 in the
option group and obviously the field contains 1's or 2's. I'm wondering if
there is a wildcard I can use to show all or some other method?


Depends on how you are filtering the report's data. If you
use the OpenReport method's Where condition argument, then
just don't specify a criteria for the field.

If you are putting the criteria in the report's record
source query, then use a criteria like:

=Forms!theform.theoptiongroup OR
Forms!theform.theoptiongroup=2
 

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