?
Solved

Cannot find table

Posted on 2005-03-05
9
Medium Priority
?
385 Views
Last Modified: 2012-08-14
Hi all,

I am using CR 10 and VB 6.

To run a report I have a function that contains the following code:

    For Each crxDatabaseTable In Report.Database.Tables
        With crxDatabaseTable.ConnectionProperties
            .Item("Provider") = "SQLOLEDB"
            .Item("Initial Catalog") = DataBaseName
            .Item("Data Source") = Server
            .Item("User ID") = username
            .Item("Password") = password
            .Item("Connect Timeout") = "5"
        End With
        crxDatabaseTable.Location = crxDatabaseTable.Name
    Next crxDatabaseTable

When the line crxDatabaseTable.Location = crxDatabaseTable.Name is removed, the report fails giving an error "the table '' could not be found" and when the line is inserted, reports that have tables with aliases fail giving the same error.  What do I do?

Thanks in advance.
0
Comment
Question by:vbtiger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 13

Expert Comment

by:vidru
ID: 13469019
The trouble with .Location = .Name failing with aliased tables is not unique to CR10.  Usually, it works great for avoiding errors at runtime, especially if the db schema was saved with the report.

What is in the table's Location currently that you're trying to get rid of?  Is it somethting like "DBName.dbo.TableName"?  You might have to revert to parsing the Location, or replacing the schema with the correct schema at runtime:

Dim strLocation As String
strLocation = LCase(crxDatabaseTable.Location)
If InStr(strLocation, ".dbo.") > 0 Then
    crxDatabaseTable.Location = (strLocation, InStr(str, ".dbo.") + 5)
End If

In any case, you've just hit one of the few instances where setting Location = Name doesn't work.

-dave
0
 

Author Comment

by:vbtiger
ID: 13469183
Hi dave,

Thanks for the response.  The table location currently is only the table name.  There is no dbo or anything.  What is the workaround?

Thanks

vbtiger
0
 
LVL 13

Accepted Solution

by:
vidru earned 500 total points
ID: 13470705
Were the reports created in a version prior to CR 9?  There are some KB articles that mention a problem with the connection information that's saved with the older reports.  The fix with those is to delete the ConnectionProperties before setting them:
        With crxDatabaseTable.ConnectionProperties
            .DeleteAll      
            .Item("Provider") = "SQLOLEDB"
            ...
            ...
        End With

What kind of database are you connecting to?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:vbtiger
ID: 13473870
Hi dave,

When I use .deleteall, then I get a subscript out of range error (because all items have been removed).

I'm connecting to a SQL Server database.
0
 

Author Comment

by:vbtiger
ID: 13473884
Dave,

I used .Add instead of .item and it works fine now.  Thanks for your help!
0
 
LVL 13

Expert Comment

by:vidru
ID: 13473977
Glad to hearit.

-dave
0
 

Author Comment

by:vbtiger
ID: 13552548
I was wrong.  It still doesn't work!
0
 
LVL 13

Expert Comment

by:vidru
ID: 13552559
Can you be a bit more descriptive?

-dave
0
 

Author Comment

by:vbtiger
ID: 13553664
When I use crxDatabaseTable.Location = crxDatabaseTable.Name, tables with aliases don't work and I get an error and I get an error "cannot find table alias_name" and when I remove it, the report picks up the default location.  But I managed to correct it by replacing the line with:
crxDatabaseTable.SetTableLocation crxDatabaseTable.Name, crxDatabaseTable.Location, adCon
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question