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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using views

Status
Not open for further replies.

apcapc

Technical User
Sep 20, 2004
17
GB
I can select from a view when I have it open in my data session but what I want to do is write a program that can be reused again and again. If I was to do it with a table I would write the following

use c:\mytable.dbf in o shared

but I can't do this with a view can I?

All I basically want to be able to do is update a field in one view with data from another view but I can't have both views selected as open at the same time as you can with tables

REPLACE customer_lastinvoicedate WITH invoiceheader_invoicedate all

The above code just doesn't work

Help please!!!
 
Why can't you open a view shared? Of course you can!

use myview in 0 shared

BUT: if you have SET EXCLUSIVE ON by accident, the tables the view is based upon will be opened exclusive and therefore a second user may not be able to open the view too.

Bye, Olaf.

 
USE customer IN 0 SHARED
USE invoiceheader IN 0 SHARED

If I open the two views with the above code and then try to run the below code I get the error message at the bottom

Any advice would be welcome

replace customer_lastinvoicedate WITH invoiceheader_invoicedate all

Variable 'Invoiceheader_invoicedate' is not found

 
The problem is that you need a period rather than an underscore, like this:

REPLACE Customer.LastInvoiceDate WITH InvoiceHeader.InvoiceDate ALL


Regards,
Jim
 
Thanks for that but it gives me exactly the same message as before, my view field is actually called customer_lastinvoicedate

Any other suggestions?

Please
 
Try:

REPLACE customer.customer_lastinvoicedate WITH invoiceheader.invoiceheader_invoicedate ALL


Jim
 

Just to add to the good points posted here:

Views are no different from tables in this respect. Just as you can open two tables in different work areas at the same time, so you can with views.

So, just write the code as if you were using tables, and all should be well.

Another point ... the use of the keyword SHARED is surely a red herring here. The problem has got nothing to do with sharing views among different users.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
REPLACE customer.customer_lastinvoicedate WITH invoiceheader.invoiceheader_invoicedate ALL

Actually, you really need the IN clause here.

Code:
REPLACE customer_lastinvoicedate WITH invoiceheader.invoiceheader_invoicedate ALL IN Customer

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top