Auto Fill Form

G

Guest

I have an order form and I would like to auto popluate the order form when I
select an item from a drop downlist.

I have a table called tblOrderDetail. The drop down is based on a table
called tblBundle. In this table I have a the following fields:

bundleID
parentID
Item
Description
Qty
ListPrice

The ParentID is the item that will be selected in the drop downlist. When
the users selects the item, I would like all items with that parentID to be
copied to the tblOrderDetail (item, description, qty, listprice).

Thanks
Matt
 
P

Pat Hartman\(MVP\)

Some fields from tblBundle must be copied to tblOrderDetail but some
shouldn't. Price needs to be copied because in order to do proper
reporting, you need the price at the time the order was placed. you don't
want the current price. However, description is not usually copied.
1. To handle the fields that are displayed but not copied - base the form on
a query that joins to the tblBundle table. Select the "display only"
fields.
2. To handle the fields that should be copied - use a query that includes
the extra fields as the RowSource for the combo. The combo is bound to the
ID field and so that will be saved automatically. In the AfterUpdate event
of the combo, you need a single line of code to save the listprice field:
Me.ListPrice = Me.cboBundleID.Column(2)

The columns of the combo represent a zero based array so .Column(2) is
actually the third column. .Column(1) is the second column. Adjust the
column number so that it selects the correct column. Don't forget to modify
the column count and column widths properties of the combo when you add the
additional fields.

And finally, set the locked property to Yes for all tblBundle fields so that
they are not accidentally modified.
 
G

Guest

I am sorry but I was not clear on what I wanted to do. I have in the bundle
table 6 rows of data or more per ParentID that all need copied to the Order
detail when that is selected. Basically I am trying to reduce the order entry
time and errors. So I have created these bundles in a seperate step that
determine if a particular item is ordered they then need other supporting
items to complete that order.

Yes there are a few items that I don't need to copy like description, but
the objective of this inquiry is to find out how to copy all items over based
on the one selection.

tblBundle
ParentID Item Price
1 Widget1 $10.00
1 Widget2 $15.00
1 Widget3 $12.00
1 Widget4 $5.00
etc

When parentID 1 is selected, I would like all the items associated with that
item to be added to the tblOrderDetails.
 
P

Pat Hartman\(MVP\)

Use an append query. You'll need to use a form field reference as the
foreign key so the rows get related to the correct order.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top