PC Review


Reply
Thread Tools Rate Thread

Deleting half completed records and copying records questions

 
 
wazza_c12@hotmail.com
Guest
Posts: n/a
 
      7th Jul 2006
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

 
Reply With Quote
 
 
 
 
Svetlana
Guest
Posts: n/a
 
      7th Jul 2006
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.

 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      8th Jul 2006
On 6 Jul 2006 18:24:52 -0700, (E-Mail Removed) 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]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete subform records without deleting main form records =?Utf-8?B?QW5pdGE=?= Microsoft Access Form Coding 0 21st Nov 2006 07:00 AM
Deleting half completed records and copying records questions wazza_c12@hotmail.com Microsoft Access 2 8th Jul 2006 01:39 AM
Create New Records in a Table by Copying Existing Records =?Utf-8?B?UnlhbkpMSA==?= Microsoft Access Queries 3 10th Mar 2006 08:11 PM
Deleting Records does not Delete Records Lucky Man Cree Microsoft Access Getting Started 7 6th Jul 2004 11:33 PM
Deleting records based on records in another table Paul Fenton Microsoft Access Queries 1 23rd Aug 2003 10:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:10 AM.