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

Set location of CR 9 using VB

Status
Not open for further replies.

rangerstud620

Programmer
Sep 17, 2003
34
US
I'm trying to link to a Crystal Report through a VB program. How do I set the location of an Excel file? I tried using the method for linking to an Access database but that did not work. Anyone have any ideas?
 
An example would be helpful. You've mentioned Crystal, Excel and Access which are rather different critters. If you can provide more detail on what your objective is, there's a better chance that someone can help.
 
I'm trying to set the source for information used in a Crystal Report by having the user select a file from a dialog box. I set the filename of the selected file equal to a variable and then I need to use that variable in a line of code to set the datasource for the CR(I'm using CR9). The following line of code is how I would set the source of an Access file named "WorkOrder.mdb" and table named "WO_INFO".

Report.Database.Tables(1).SetTableLocation "\\2000SERVER1\EXE$\Work Order\WorkOrder.mdb", "WO_INFO", ""

I need to set the source of an Excel file instead of an Access file. I modified the above code and that didn't work and so I tried the following code:(where strOpenExcel contains the file path to the Excel file and Sheet1 is the worksheet in Excel)

Report.Database.SetDataSource strOpenExcel, "Sheet1"

I've tried several variations but nothing has worked yet. I hope this clears up any confusion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top