A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form/subform for inputting data



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2004, 12:38 PM
Primoz Bradac
external usenet poster
 
Posts: n/a
Default Form/subform for inputting data

Hi everyone!

I'm interested in the solution of the following "problem":

Let's have two tables in an orders database: tblOrders and
tblOrdersDetails. To enter data into these two tables the user has to be
presented a form with a subform. He first has to fill in the information
about the order (order number, CustomerNo, Date etc.) into the form and
as many entries for order details (Part, quantity, unit of measurement
etc.) as needed into the subform.

As the data integrity is enforced (the two tables are related through
the order number) the record in tblOrders has to be inserted before any
order items are added. How is this achieved?

What is the general or most common approach to it? What is usually used
with the subform: the datasheet or form view (the former offers somewhat
better view about what has been entered already)

Or is it better to first show the user the form (without any subform)
for entering general data about the order (which adds a record in the
tblOrders table) and then show him the form for entering order details.
What if he changes his mind and stops before entering any order details.
How to get rid of the orphan record in the tblOrders table in this case?

I'd appreciate any hints or references.
TIA,
Primoz
  #2  
Old June 4th, 2004, 01:59 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default Form/subform for inputting data

The way Access works, if the user "leaves" the main form (say, by clicking
into the subform), the data in the main (Order) form is saved. If the user
then starts to enter subform data (OrderDetail), that subform (and related
table) have a row started, "inheriting" the main form's ID.

This is only true if the subform is correctly related to the main form via
the Parent/Child field properties.

As to how a user might delete a main form (Order) record, you could add a
Delete button. A note ... if the main form is bound to your "parent"
table, a record in that table wouldn't, technically, be called an "orphan".
An "orphan" record would be a row in the child table (OrderDetail) that had
no parent table row to point to.

--
Good luck

Jeff Boyce
Access MVP

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.