Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Deleting half completed records and copying records questions

Discussion in 'Information Technology' started by wazza_c12@hotmail.com, Jul 28, 2006.

  1. wazza_c12@hotmail.com

    wazza_c12@hotmail.com
    Expand Collapse
    Guest

    Hi All

    Say I'm using a form/sub form to enter purchase orders

    This consists of

    header information (in one table).
    Line Item Info (in a subform) in another table.

    Question 1:

    Best method to cancel entering a new order?
    Say a user has entered 2 line items and some header info and decides to
    cancel the entry/order ...... in a simple 1 table scenario I would use
    Me.Undo ...... but as line item records have already been written to a
    separate table, what do I do ???? Would a Me.Undo trigger cascade
    delete and remove the offending lineitems OR would I need to do a
    delete where foreign key = .... On the lineitem table THEN do a
    Me.Undo ..... or is there a better way?

    Question 2

    I want to have the functionality for a user to be able to clone the
    lineitems from a chosen order number, but enter different header
    information (to save time etc) ... What is the best way to do that? I
    have not done anything along those lines before.

    Cheers

    Warwick
     
  2. Loading...


  3. Svetlana

    Svetlana
    Expand Collapse
    Guest

    Not sure it's the best way but you could do these:
    On close event of your form write a routine that selects all lineitems
    that have been entered into your second table where the foreignKey is
    Null and deletes them.

    Similar for your second question create a button which every time its
    clicked copies the current lineitems and using inputbox function
    collects the new header information and save all as a new entry.
     
  4. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On 6 Jul 2006 18:24:52 -0700, wazza_c12@hotmail.com wrote:


    >Question 1:
    >
    >Best method to cancel entering a new order?
    >Say a user has entered 2 line items and some header info and decides to
    >cancel the entry/order ...... in a simple 1 table scenario I would use
    >Me.Undo ...... but as line item records have already been written to a
    >separate table, what do I do ???? Would a Me.Undo trigger cascade
    >delete and remove the offending lineitems OR would I need to do a
    >delete where foreign key = .... On the lineitem table THEN do a
    >Me.Undo ..... or is there a better way?


    Undo won't work, period. When you setfocus to the subform the mainform
    record is saved to disk; when you setfocus back to the mainform, or
    move between records on the subform, the subform record will be saved.

    You'll need to set Cascade Delete on the relationship between the main
    form's table and the detail table, and run a Delete query or put a
    button on the mainform to delete the current record; the child records
    will be deleted by the cascade.

    >Question 2
    >
    >I want to have the functionality for a user to be able to clone the
    >lineitems from a chosen order number, but enter different header
    >information (to save time etc) ... What is the best way to do that? I
    >have not done anything along those lines before.


    An Append query would work here. Not sure how you'ld want to enter the
    different header data, or how you'ld pick which child records to
    append though!

    John W. Vinson[MVP]
     

Share This Page