> Hi, all; I am converting a VFP report to a MSSQL backend. The VFP report has the .dbf graphically embedded in the Data Environment. I deleted that, put my SQLEXEC statements in the Init method. In that method, I get the correct number of records in the recordset (named "Customers"). However, when I "SELECT CUSTOMERS" I get the error "Alias 'CUSTOMERS' is not found." I am using a Private Data Session. Am I missing something?
Susan,
If you are using a MySQL backend, you have three choices:
1 - Use SQL Pass Through (SPT). I take it that you already have a connection. You can use that connection in your report as well. Delete your tables from the report's DE and in the DE's .OpenTables method, add your SQLEXEC statements. I typically use this concept with my apps (done with a SQL backend) and create a "Report Cursor." Rather than build a series of cursors to exactly replicate the report's DE, I create a single flatfile (non-normalized) cursor for my report. (I am not saving the data in the cursor to disk so I don't care if the data is normalized.) Now I have one cursor containing all of the fields and records that I need for my report, and only the fields and records I need for my report.
2 - Use a parameterized CA. You can drop a CA onto a report's DE just as you would a form's DE.
3 - Use a parameterized remote view. Again, you can drop a view on the report's DE as well.
I suspect that you are trying to duplicate the table concept in your report and this is what is giving you grief. The error message however is probably due to a group by or print when option that is still looking for the old tables rather than your SPT cursors. With a flat file report cursor, you just preface everything with your report cursor's alias.
Ken
You shall know the truth - and the truth shall set you free. (John 8:33)