Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EDITing OR APPENDing to LOCAL VIEWS
Message
From
24/11/1999 19:55:06
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
 
 
To
24/11/1999 12:05:24
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00295056
Message ID:
00295418
Views:
16
Hi Eric,

Thanks for your reply.

My problem still exists.

I am trying to use local views to update invoice file, along with the invoice items, sales order along with the items, customer along with their shipping addresses, etc.

At this moment, I am trying to code the customer file with the multiple shipping address information.

To accomplish this, I have two tables and one local view:

1) Customer Table, Primary Index: CustCode
------------------------------------------
2) Customer_Ship_To Table Primary Index: CustCode + ShipToCode
--------------------------------------------------------------
3) lvCustomer_Ship_To Local View
---------------------------------
All the above are linked to the AMS database.

The following is the definition of my local view:
SELECT Customer_ship_to.shiptocode, Customer_ship_to.shipname,;
Customer_ship_to.shipaddress1, Customer_ship_to.shipaddress2,;
Customer_ship_to.shipaddress3, Customer_ship_to.shipcity,;
Customer_ship_to.shipprovincecode, Customer_ship_to.shipcountrycode,;
Customer_ship_to.shippostalcode, Customer_ship_to.shipattention,;
Customer_ship_to.custcode;
FROM ams!customer_ship_to;
WHERE Customer_ship_to.custcode = ?Customer.Custcode

Within the "Update Criteria":
The "Send SQL updates" is "checked
For the "SQL WHERE clause includes": Key and modified Fields is chosen
For the "Update Using": The SQL UPDATE is chosen
All my fields are slected to be updated, and my key fields are CUSTCODE and SHIPTOCODE which are also defined as updatable.

Within the LOAD() event of my main customer form (frmCustomer) I code the following:
USE CUSTOMER_SHIP_TO IN 0 ORDER TAG SHIPTO OF CUSTOMER_SHIP_TO
CURSORSETPROP("Buffering", 3, "CUSTOMER_SHIP_TO")
USE CUSTOMER IN 0 ORDER TAG CUSTCODE OF CUSTOMER
CURSORSETPROP("Buffering", 3, "CUSTOMER")
USE lvCustomer_Ship_To IN 0

Upon loading the frmCustomer_Ship_To form, (by clicking on a command button on my main Customer form (frmCustomer)), I issue a REQUERY("lvCustomer_Ship_To"), so the Shipping Address pertain to the customer chosen.
I have grid display (grsCustomer_Ship_To) which appears, whose RecordSource is lvcustomer_ship_to and RecordSourceType is "1-Alias"
Within this form I allow "Add", "Edit". "Remove", etc., of the Shipping Addresses.

THIS IS WHERE I AM STUCK:

A. Upon editing an existing address, the changes are accepted and are all visible instantly within my Grid. OK

B. .If I remove an address by issuing a DELETE and a TABLEUPDATE(0,.T.) it removes itself from the grid; If I then re-add the same SHIPTOCODE for that Customer, I get a "Unique violation" error...this probably has something to do with my "Primary Index Key"...why do I get this? I just previously deleted it? It is actually unique.

c. If I add a completely new SHIPTo code it is not visible within my grid. I issue a TABLEUPDATE(0,.T.) after every addition. I also issue a REQUERY("lvCustomer_Ship_To") after every TABLEUDATE(0,.T.) along with a ThisForm.grdCustomer_Ship_To.Refresh(). The data is actually stored in the bas table CUSTOMER_SHIP_TO. I checked. If I close all the forms and reopen them I see the additions. Closing the frmCustomer_Ship_To form is not enough. I must close and reopen the main frmCustomer form also.

Is there something I missed?

I apologize for this lenghtly reply, but I am failry new to VFP....It is the first time I am using Local Views. I find them pretty frustrating.

Thanks again
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform