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

Crystal Rpt Load in VB w/o hardcoded path

Status
Not open for further replies.

wendas

MIS
Apr 20, 2001
92
US
Hi,
I downloaded a code example that has this code
[red]
' Load the report
rptExpensiveProducts.Load("..\TenMostExpensiveProducts.rpt")
[/red]
Looks easy and makes sense. This works (but this code is on local drive)

My code is on a server.. But this code if it is saying look in your local folder I would think would work where ever I dropped it.

But I created a program.. It works if I hard code in the full Path, but not if I change the path to "..\reportname.rpt".

Is there something else I need to do to get this to work? Or is it due to the code being on the server. (I really don't want all code to fail if we choose to move code to a different server, so I don't want to be so hardcoded with the path")

Thanks
 
Well it is Not the difference of server vs local.. I just moved the sample code that it works with to my server. It still works.
 
never figured out why the example code worked with a path of "..\" If someone can tell me the missing link let me know.

I did find a work around.
[red]
'Figure out the pathname for the current folder (this is startuppath minus the \bin\debug)
strpath = Application.StartupPath
intlen = InStr(strpath, "\bin")
strpath = Mid(strpath, 1, intlen)
' Load the report
cryrpt.Load(strpath + "rFirstReport.rpt")
[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top