CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Location
    Mexico
    Posts
    12

    Conecting tables in different Databases

    Hi to everyone.

    Does anyone remember VB5 and Crystal Reports 4.6.1.?

    I created a report which invokes two tables that are in different Access Databases which are password protected.

    The thing is that I Can´t find the way to point to the Databases when they are in other location than the used when the report was created.

    I already try this but no success…

    FormX.Cr1.DataFiles(0) = DbPath1 & "db1.mdb"
    FormX.Cr1.DataFiles(1) = DbPath2 & "db2.mdb"

    Your help will be much appreciated

    Thanks in advance.

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Conecting tables in different Databases

    Are You sure that DbPath1 and DbPath2 ends with a '\'

  3. #3
    Join Date
    Jul 2003
    Location
    Mexico
    Posts
    12

    Re: Conecting tables in different Databases

    Quote Originally Posted by jggtz View Post
    Are You sure that DbPath1 and DbPath2 ends with a '\'
    Hi jggtz , tahnks for you answer...

    Yes, in fact

    DbPath1 is C:\Proyectos\CopyJet2\Servicio\

    and

    DbPath2 is C:\Proyectos\CopyJet2\Factur 2.5.5\

  4. #4
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Conecting tables in different Databases

    In my opinion the syntax is correct...
    Check if you Save Data With Report,
    Also, may you post your code (Printing routine) I would like to see how you are handling the password protection

  5. #5
    Join Date
    Jul 2003
    Location
    Mexico
    Posts
    12

    Re: Conecting tables in different Databases

    Thanks jggtz...

    This is the code... the databases are now, Not password protected, so that´s not an issue for this problem.

    With CR

    For X = 0 To 10
    .Formulas(X) = ""
    Next X

    .DiscardSavedData = True
    .ReportFileName = "C:\Proyectos\CopyJet2\Servicio\rptSolicitudPartesPorReporte.rpt"
    .DataFiles(0) = "C:\Proyectos\CopyJet2\Servicio\Servicio.mdb"
    .DataFiles(1) = "C:\Proyectos\CopyJet2\Factur 2.5.5\Sifacbas.mdb"
    .Action = 1

    End With

    I´m also observing the order in which databases must be asigned in the DataFiles array.

    Thank you very much. I hope this can lead you to a clue

  6. #6
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Conecting tables in different Databases

    Syntax seems ok
    Only one thing ... Change the directory name "Factur 2.5.5" removing blanks and/or periods and give a try...

  7. #7
    Join Date
    Jul 2003
    Location
    Mexico
    Posts
    12

    Smile Re: Conecting tables in different Databases

    HI jggtz....

    At the end I found the key of this matter...

    What happens is that in the DataFiles array, is created an entry of the database path for each table in the report.

    Since in the report of this case are used three tables of the "Servicio.mdb" database, and two tables of the "Sifacbas.mdb" database, the DataFiles array must be:

    Cr1.DataFiles(0) = "C:\Proyectos\CopyJet2\Servicio\Servicio.mdb"
    Cr1.DataFiles(1) = "C:\Proyectos\CopyJet2\Servicio\Servicio.mdb"
    Cr1.DataFiles(2) = "C:\Proyectos\CopyJet2\Servicio\Servicio.mdb"
    Cr1.DataFiles(3) = "C:\Proyectos\CopyJet2\Factur 2.5.5\Sifacbas.mdb"
    Cr1.DataFiles(4) = "C:\Proyectos\CopyJet2\Factur 2.5.5\Sifacbas.mdb"

    And with this the case is solved

    jggtz, I really appreciate your kind attention to this problem.

    Have a great year!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured