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!

Error logging onto tables when use activeX viewer

Status
Not open for further replies.

Spuriousbugfix

Programmer
Apr 29, 2003
8
GB
I have written an ASP app using the activex viewer that allows users to add their own reports and run them in the web.
This has been working fine until now. I use the usual methods for running the report and logging it onto the correct database etc. Some users have written reports using table names that are aliased. This is now causing an error
Error Occurred Logging onto tables: The Table Person_1 could not be found.
I know why this is happening but am not sure how to fix it.

Here is the code I use

Set CRTables = Session("oRpt").Database.Tables
For Each CRTable in CRTables
CRTable.SetLogOnInfo cstr(ODBC),cstr(Database),cstr(User),cstr(Pass)
If CRTable.Location <> "Command" then
CRTable.Location = CRTable.Name
end if
Next
 
What's in the Location property that you're trying to get rid of? Is it some kind of database schema? You might need to parse the Location property to get rid of the schema. For instance, if the Location looks like "Database.dbo.TableName", you can get to the table name like this:

If InStr(CRTable.Location, ".dbo.") > 0 Then
CRTable.Location = Split(CRTable.Location, ".")(2)
End If

-dave
 
In the end I did this

CRTable.Location = CRTable.Location
Seems to work.
If I do not set the location I can only run the report against the database it was written against.
I was doing
CRTable.Location = CRTable.Table
as this was what was suggested to me and appeared to work.
However
CRTable.Location = CRTable.Location
seems to do the job and doesn't cause the issue when the tables have been aliased.
I have no idea why you have to set the Location as it only has the table name or aliased name or stored proc name in anyway. There is no dbo at the beginning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top