Criteria

Treason

#@$%#!
Local time
Today, 05:19
Joined
Mar 12, 2002
Messages
340
I have a query called Schedule_Table which lists a students Schedule by ID#. This query is used in a form and also in a report. In the Criteria for Stud_ID i put [Enter ID # for Schedule] so that way when the query is ran, a popup box will appear and it'll filter by given ID. So here's my question. Suppose say I wanted to print 30 schedules, but i didnt want to run the query 30 times giving a different ID every run. For Example, when prompted can I enter 0001, 0002, 0003 or 0001 & 0002 & 0003? Or something to that effect that will bring up more than one criteria.

Thanks for your time,
Treason
 
In your criteria you could put:

Between [Enter first ID:] And [Enter Last ID:]


This will then give you a range...
 
Thanx for the info but that isn't working. when the query is run, i get an empty set. Any other ideas?
 
Try:

Between val([Enter first ID:]) And val([Enter Last ID:])

If it doesn't work, look up 'Between' in the help file. This function will give you a range.
 
No to be a stickler Yellow, i do appreciate your replies, but I don't think I was very clear on what I wanted to do. It is not really a range I am looking for, but multiple values. The ID's could be 1234 ad 6512.
 
A quick thought; why not using a MultiSelect ListBox?

RV
 
I don't think a multi select listbox would be resonable because I have over 3000 ID's and because I am trying to print reports based on these ID's. I created a command button that will print the report, but sometimes I need 10 reports at a time, based on 10 different ID numbers. So instead of clicking the button 10 times and inputting a different ID each click, could I enter all the ID's I want the report based on at once?

I hope that clarified something
Thanx again
Treason
 
I am not too sure how to even use a multi select listbox, but i will read up on it more. Just to make sure, there is no way to have it so when I click on the print button of a report is prompts for ID as many times as i wish, until I enter a null value?
 
Put the following expression in your query:
InParam([stud_id],[Enter ID#'s Separated by comma])
Then do the following.

Copy the following Code to a module named basInPram

Function GetToken(stLn, stDelim)
Dim iDelim As Integer, stToken As String
'Searches for commas as a delimiter
iDelim = InStr(1, stLn, stDelim)
If (iDelim <> 0) Then
stToken = LTrim$(RTrim$(Mid$(stLn, 1, iDelim - 1)))
stLn = Mid$(stLn, iDelim + 1)
Else
stToken = LTrim$(RTrim$(Mid$(stLn, 1)))
stLn = ""
End If
GetToken = stToken
End Function

Function InParam(Fld, Param)


Dim stToken As String
'The following two lines are optional, making queries
'case-insensitive
Fld = UCase(Fld)
Param = UCase(Param)
If IsNull(Fld) Then Fld = ""

'Parses out Values separated by commas
Do While (Len(Param) > 0)
stToken = GetToken(Param, ",")
If stToken = LTrim$(RTrim$(Fld)) Then
InParam = -1
Exit Function
Else
InParam = 0
End If
Loop
End Function
 

Users who are viewing this thread

Back
Top Bottom