Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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]
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page