Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User defined entries in a report 1

Status
Not open for further replies.

Yukonbanzai

Technical User
Mar 18, 2004
36
CA
I have a report that lists information about students for going on trips. I need a way that the user can decide which students names will appear on the report. Students that are not on the trip shouldn't be on the report.

Any help appreciated
 
Got rid of the parameter request by making the record source for the medical report the qryData as you said to. (missed that one)

Now I get a blank report eventhough I've selected numerous names.
 
Please post back the DoCmd.OpenReport that you have in your code. Also, you could put a STOP command just in front of this line of code to see the actual value of the vData variable. When the code stops open the immediate window and type ?vData and then press Enter. The resulting string will be what was built in the looping through of the selected cadets. Copy and paste this in your next posting.

By the way it is getting pretty late here in Michigan. From your TT user handle are you located in Alaska?

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Code as follows:

DoCmd.OpenReport "Medical Data", , , "InStr(1, Cadet_Names(),[Cadet_Names])>0"

I'm in Whitehorse, Yukon, Canada.
Right next door to Alaska, go there all the time.

Russ
 
DID the Stop thing and ran ?vData. It returned the exact name I had Hilighted.
 
Good. It should. If you select multiple names then it should have them all listed in a long string with a semi-colon seperating them.

Now the
DoCmd.OpenReport "Medical Data", , , "InStr(1, Cadet_Names(),[Cadet_Names])>0"

. . should select the the records correctly for the report.

Does it? I am going to bed now but will check your response in the morning. I know exactly where you are. You are in God's country. I would love to live there.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
I see a typo and a change to the WHERE parameter expression.

Add the red "s":
Code:
Public Function CadetNames() as String
CadetName[red]s[/red] = vData
End Function

Replace the OpenReport statement with this:
Code:
DoCmd.OpenReport "Medical Data", acViewPreview, , "[red](((InStr(1,CadetNames(),[Last Name] & ', ' & [First Name]))>0))[/red]"

I have tested this now and it works as advertised.


Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
All the error and parameters are gone. Only thing left is that when I run the report, the names from the last run remain.
Example: I run the report for cadets a,b, and c.
Close form after printing.
Open form and run for cadets e,f,and g.
When I veiw the report, it shows a,b,c,e,f, and g.
 
Not sure if this is relevant or not,
When I close the db and reopen it, the form works fine.
It just seems that its not deleting the previous selections.

Russ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top