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!

Connecting To Access Using The Connect Method

Status
Not open for further replies.

SharpTool

Programmer
Nov 4, 2002
2
GB
I am using the Crystl32.ocx to connect to MS Access. This works OK providing the DSN has the full database path specified. However I should be able to you the default DSN ("MS Access Database"), that gets installed with office, and pass the path of the database through in the vb code.

I have downloaded the "logon_ocx.pdf" from the Crystal web site and tried everything that they suggest to pass the data path to Crystal, but can't get it to work. Below is some of the code used, plus some things that I have tried. I would be grateful for any help.

This Works
----------
DBPath = App.Path
If Right(DBPath, 1) <> &quot;\&quot; Then DBPath = DBPath _
& &quot;\&quot; 'Database path = current path

CR1.ReportFileName = DBPath & &quot;MainPrint.rpt&quot;
CR1.Connect = &quot;DSN=CustomerReturns&quot;
CR1.Action = 1

This Should Work
----------------
This works (with CustomerReturns DSN pointing to the right database.

You should be able to replace line
CR1.Connect = &quot;DSN=CustomerReturns&quot; with

CR1.Connect = &quot;DSN=MS Access Database;UID=Admin; _
PWD=;DBQ=<CRWDC>Database=C:\CustRet.mdb&quot;

I have tried various different methods of this command plus the Datafiles(x) command but I can't get it to work.

Please Help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top