Help: Open a Table from within a Report?  
Author Message
D. Rudd





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

Hi,

I am supporting an Accounts program that is written in Visual Foxpro.

I am editing a Report using the Report Designer and the Data I wish to access is in a Table that is not open in the Data Environment, and I cannot simply Open it and Save as the Data Environment reverts when re-opened.

I am aware that there is a way to Open a Table in the Header of the Report by adding a Field and using a Command in the Expression Builder as I found out about a year ago, unfortunately I cannot remember or find the Command for doing this.

Can anyone put me out of my misery and give me some help on how to acheive this

Many Thanks.



Visual FoxPro2  
 
 
chanmy8





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

Hi,

You can open your table manually before REPORT FORM.

*** Command.Click()

IF NOT USED('mytable')
USE mytable AGAIN SHARED IN 0
ENDIF

SELECT mytable
REOPRT FORM myreport PREVIEW

HTH

 
 
D. Rudd





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

Hi,

Thanks for your answer, but I do not have access to Program / Command Line.

 I am using a Complied Program that has Report Designer built into it, I am familiar with VFP method you described but unfortunately I cannot use it in this case.

I have previously attached a Field into the Header of the Report and added a Expression that will open a Table that was not in the Data Environment but I cannot remember how I did it.

Do you have any ideas how to acheive this in this manner

Many Thanks Again!


 
 
dni





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

Then you may use a expression with field:

expression(<table name>.<field name>) where expression can be (any from the list depending by field type), or try for test without expression.



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

An ugly way of doing that is to insert a field with an alias. Not finding the alias VFP prompts for the table.


 
 
Tamar E. Granor





PostPosted: Visual FoxPro General, Help: Open a Table from within a Report? Top

The command to open a table is USE:

USE MyTable

Since you probably don't have access to the VFP compiler, though, you'll have to run it as a script, like this:

EXECSCRIPT("Use MyTable")

You can probably put that in the On Entry band for the page header.

Tamar