Radar- Help With Field Displaying a Groups in one field

  • Thread starter Thread starter Radar
  • Start date Start date
R

Radar

Not sure which group this one falls in .
I have a shipping report with a list of venders that are sorted by
delivery days out.
My days out field is in my rpt Page header. If I query for vendors
that are 3 days out. It shows the #3.
My question is! What if I query Days 1,2,3 (it will only display one
of these numbers.
How do I Have the Place a field to display 1,2,3 or what every
combination I choose.

Thanks
Radar.
 
If I understood the question correctly, possibly what you may be looking for
is the 'IN' keyword, something like ...

SELECT * FROM TableName WHERE DaysOut IN(1, 2, 3)

This will return all records where the DaysOut field includes the value 1,
2, or 3.

This is a short-hand way of writing the following query, which would return
the same results ...

SELECT * FROM TableName WHERE DaysOut = 1 OR DaysOut = 2 OR DaysOut = 3

Other alternatives include ...

.... WHERE DaysOut BETWEEN 1 And 3 ...

.... or ...

.... WHERE DaysOut >=1 AND DaysOut <=3
 
For give me for not being clear.

I have a rpt with the detail section displaying two fields "Vendors" &
"Days Out" I have the page setup to display 6 columns.
What I want to do is remove the field "Days Out" to allow me to add
more columns and in the Page header I want the shiper to see that
this list was created from these select groups

Thanks
 
If your range is sequential, without gaps (e.g. 1, 2 and 3 as in your
previous example) then an expression like this as the control source of the
text box in the report header should do it ...

="Days Out Between: " & Min([DaysOut]) & " and " & Max([DaysOut])

I can't think of any simple solution if the range is not sequential, e.g. if
it includes 1 and 3 but not 2.
 
Radar said:
Not sure which group this one falls in .
I have a shipping report with a list of venders that are sorted by
delivery days out.
My days out field is in my rpt Page header. If I query for vendors
that are 3 days out. It shows the #3.
My question is! What if I query Days 1,2,3 (it will only display one
of these numbers.
How do I Have the Place a field to display 1,2,3 or what every
combination I choose.

Thanks
Radar.

Brendan Roberts gave a good answer, assuming that you know ahead of time
which combination you want. But suppose you want to choose a different
combination each time you run the Report? One way to do that (not
perhaps the best possible) is to have a Table with yes/no checkboxes
that can be set up before running each Report.

For example, suppose the list of expected deliveries looks like this
(although it's a Table in this example, it would normally be a Query
based on expected delivery dates and knowledge of what today's date is):

[Deliveries]

DaysOut Vendor
------- ------
10 GreenSlime
2 Acme
1 Yummy
4 BrandX
2 Jerx

Then we could have a Table in which the [IsReported?] field could be
used to select the specific day numbers to be listed in the Report:

[Days]

Number IsReported?
------ -----------
1 Yes
2 No
3 No
4 No
5 Yes
6 Yes
8 No
10 Yes
20 Yes

Which of those possible numbers happen to be selected could be returned
by the following Query:

[Q_Selected]

SELECT Days.Number
FROM Days
WHERE (((Days.[IsReported?])=Yes))
ORDER BY Days.Number;

Number
------
1
5
6
10
20

.... and a list of the vendors whose deliveries are expected on any one
of those days would be returned by this Query:

[Q_VendorsByDay]

SELECT Deliveries.Vendor, Deliveries.DaysOut
FROM Days INNER JOIN Deliveries
ON Days.Number = Deliveries.DaysOut
WHERE (((Days.[IsReported?])=Yes))
ORDER BY Deliveries.DaysOut;

Its output would look like this:

Vendor DaysOut
----------- -------
Yummy 1
GreenSlime 10


It wasn't clear to me from the message if a list of the selected days
were desired in the Report. Assuming it is, the following VBA function
would produce that list (based on the [Q_Selected] Query):


'Return a comma-separated list of all
' selected choices of delivery dates
Public Function DaysList() As String

Dim rsQuery As Recordset
Dim strList As String

Set rsQuery = CurrentDb.OpenRecordset("Q_Selected")

Do While Not rsQuery.EOF

'Grab the next selected value
strList = strList & ", " & rsQuery.Fields(0)

rsQuery.MoveNext 'Next record, if any

Loop

'Delete the leading ", "
DaysList = Mid$(strList, 3)

rsQuery.Close 'Clean up
Set rsQuery = Nothing

End Function 'DaysList()


Having defined these Queries and this function, you could then design a
Report whose Record Source is [Q_VendorsByDay] to display the results.
In this Report, the Report Header contains a Text Box whose Control
Source property is =DaysList() , the function we defined:

+---------------------------------------+
| Days reported: 1, 5, 6, 10, 20 |
| |
| DaysOut Vendor |
| ------- ---------- |
| 1 Yummy |
| 10 GreenSlime |
| |
| |
+---------------------------------------+

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
Vincent Johns said:
Brendan Roberts gave a good answer, assuming that you know ahead of time
which combination you want. But suppose you want to choose a different
combination each time you run the Report?

I was assuming that the report would be based on a parameter query. Now that
you mention it, though, there certainly are other ways of filtering reports,
and the most appropriate answer may depend on what method is being used.
 
Back
Top