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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help a newbie please 1

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
If anyone has some free time on their hands please help me figure out this problem :) I am going to try to explain from the beginning. I have 2 tables, Student table, and a Hospital table. They both share a common field HospitalID and I linked them in the Visual Linking Expert. The Student table also contains a Lastname field, while the Hospital table contains a Hospital_Name field. From visual basic I select a hospital name and pass it to crystal reports via a parameter field named {?Hospital}, after which I need to list all the Lastnames of people where Hospitals match. I tried to get this right last thursday but no luck :) I am not very experienced in CR, and need to learn this quickly, no time for books and such. If anyone can explain step by step on how to do this or point me somewhere i can learn this id be greatful. Thanks :)
 
anyone...anyone...? i'll sell my soul :)
 
What is the report returning now when you run it?
If it is all the last names, then
have you linked the parameter field {?hospital} to the report with the Select Expert?


 
Yep I put the following in the select expert
{HOSPITAL.HOSPITALID} = {?Hospital}
and it returns nothing at all

if I remove everything then it returns all last names
 
Yep I put the following in the select expert
{HOSPITAL.HOSPITAL_NAME} = {?Hospital}
and it returns nothing at all

if I remove everything then it returns all last names
 
Maybe i first need to make a formula which gets HospitalID of the Hospital_Name then use that formula in the linking expert?

Can someone please post the correct syntax to write the following formula ?

If {student.hospital_name} = {?hospital} then select {student.hospitalid} of that {student.hospital_name} ?
 
thanks brett that did it, gonna try the other stuff now, making progress yay ;)
 
Ok I have made 2 formulas,

@GetID

If
{HOSPITAL.HOSPITAL_NAME} = {?Hospital}
then
{HOSPITAL.HOSPITALID}

Which gets the HospitalID based on the Hospital Name the user selects through Visual Basic

and @Name

If
{STUDENT.HOSPITALID} = {@GetID}
then
{STUDENT.LASTNAME} + ", " + {STUDENT.FIRSTNAME}

Which was added to the report and should fill in the names of all the people whos hospitalid matches the @GetID

Now can someone PLEASE give me some clues as to why this still does not work? What am I missing?
 
Ok I found the problem, if I remove @name from my report and pass the Hospital Name from VB to {?Hospita} it works just fine, but as soon as I put in the @Name formula I get the Vb Runtime error 20599, Does anyone have any idea what it could be?
 
It says "A string is required here" and points to ToNumber or GetID, not sure which? perhaps if we change GetID to string before we change it to number? whats the syntax for that?
 
Hmm I dont think you can do CStr cause it doesnt get high lighted in blue and it still gives an error saysing "a Number, currency, string or boolean expected there"

so what should i do? change the field to number or string in the database?
 
have you solved your problem?
you just reverse linking then instead of using parameter value try to give manually different hospital names. Because first thing you should check without passing parameter that whether it is displaying both Hospital name and last name or not then proceed with it. If still problem is there let me know
 
m99 Cstr doesnt work for some reason, maybe since I am using CR 7?

Billie yes Hospital and Name display fine without passing parameters

 
Ok I found out why it fails, when i put the lastname field on the report, and do a preview in crystal it asks me for a name for the ?Hospital so i put it any hospital since its a preview, then when I go to VB and generate the crystal report unless I select the same hospital (to pass as a parameter) in the combobox that I put it when i previewed it will fail. Any clue why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top