[Crystal Reports] Change database location

Stoffel

Member
Joined
Dec 11, 2004
Messages
16
Location
Belgium
Programming Experience
1-3
Hi,

How can I change the database location in my report?

I tried this:
VB.NET:
  Dim rpt As New CrystalReport1
  For Each crTable As Table In rpt.Database.Tables
    crTable.Location = Directory.GetCurrentDirectory & "\database.mdb"
  Next
But I couldn't use that because my Visual Studio doesn't recognize "Table"

Then I tried this:
VB.NET:
          Dim rpt As New rptRapport
          Dim path As String

          path = GetDirectoryName(Application.ExecutablePath)

          For i As Integer = 0 To rpt.Database.Tables.Count
            rpt.Database.Tables(i).Location = path & "\kookboek.mdb"
          Next
But then I get this error: "Error in ....rpt Invalid table number."

Any Help?
 
not sure what your trying to do... but have you tried tracing it?

if you have.. what happened? when does the error occur?

dont know if this'll work.. but if your for statement is working... upto a certain point..
try
For i As Integer = 0 To rpt.Database.Tables.Count-1
rpt.Database.Tables(i).Location = path & "\kookboek.mdb"
Next
 
Last edited:
Back
Top