473,404 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Basic Subform Question - Pulling Up A Price

I have an InvoiceLines subform on an invoice table. In the subform, I
have the following fields that are bound to the actual InvoiceLines
table:

Class (the type of product)
Product (the specific product)
Price
Quantity
Subtotal

When someone selects a product class, the options in the product
dropdown change to only those products in that class. Class looks up
in a ProdClass table that lists all the possible product classes, and
this table is related by ClassID to the Prod table, which lists the
individual products and their prices.

How do I get it so that when someone selects a product from the
Product dropdown, the price listed in the Prod table is automatically
filled into the Price field in the InvoiceLines subform?

I can do a simple VB script that says "If Product = Widget then Price
= $5.95," but that would get real cumbersome real fast.

Any ideas?

Mar 5 '07 #1
3 1402
You can either use a bound form or use a DLookup statement to populate
the Price textbox.

On Mar 5, 12:57 pm, dancol...@gmail.com wrote:
I have an InvoiceLines subform on an invoice table. In the subform, I
have the following fields that are bound to the actual InvoiceLines
table:

Class (the type of product)
Product (the specific product)
Price
Quantity
Subtotal

When someone selects a product class, the options in the product
dropdown change to only those products in that class. Class looks up
in a ProdClass table that lists all the possible product classes, and
this table is related by ClassID to the Prod table, which lists the
individual products and their prices.

How do I get it so that when someone selects a product from the
Product dropdown, the price listed in the Prod table is automatically
filled into the Price field in the InvoiceLines subform?

I can do a simple VB script that says "If Product = Widget then Price
= $5.95," but that would get real cumbersome real fast.

Any ideas?

Mar 5 '07 #2
On Mar 5, 1:54 pm, "ManningFan" <manning...@gmail.comwrote:
You can either use a bound form or use a DLookup statement to populate
the Price textbox.
Can you be a bit more specific? I really have no idea what I'm doing
here :)

Thanks!

Mar 5 '07 #3
How about including the Price fields as columns in your combo-box?
Then use the combo's AfterUpdate event procedure to insert the value of the
price column into the appropriate field in the subform.

Something like this (from one of my invoicing apps):

Private Sub cboPartNumber_AfterUpdate()

Me![LINE] = Me![cboPartNumber].Column(1)
Me![QtySold] = Me![cboPartNumber].Column(2)
Me![REG] = Me![cboPartNumber].Column(3)
Me![SALE] = Me![cboPartNumber].Column(4)
Me![DESC] = Me![cboPartNumber].Column(5)
DoCmd.GoToControl "QtySold"

End Sub

Here is the Row Source for the combo-box above.
SELECT tblToolshow.BASIC, tblToolshow.LINE, tblToolshow.QTY,
tblToolshow.REG, tblToolshow.SALE, tblToolshow.DESC FROM tblToolshow ORDER
BY tblToolshow.BASIC;

HTH,
Don

BTW.
"cboPartNumber" is the name of my combo-box and is bound ( Column(0) ) to
the "PartNumber" field on the datasheet-style subform.
[LINE] is "Product Line", [REG] is "Regular Price", [SALE] is the "Sale
Price", and [DESC] is the "Part Description"
<da*******@gmail.comwrote in message
news:11**********************@64g2000cwx.googlegro ups.com...
I have an InvoiceLines subform on an invoice table. In the subform, I
have the following fields that are bound to the actual InvoiceLines
table:

Class (the type of product)
Product (the specific product)
Price
Quantity
Subtotal

When someone selects a product class, the options in the product
dropdown change to only those products in that class. Class looks up
in a ProdClass table that lists all the possible product classes, and
this table is related by ClassID to the Prod table, which lists the
individual products and their prices.

How do I get it so that when someone selects a product from the
Product dropdown, the price listed in the Prod table is automatically
filled into the Price field in the InvoiceLines subform?

I can do a simple VB script that says "If Product = Widget then Price
= $5.95," but that would get real cumbersome real fast.

Any ideas?

Mar 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
30
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform named "sbfrmParts" with a list of parts along with the quantity and price. I have used a text box in the subform's footer and set the control source to "=Sum(*)". I set the...
0
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a query. ...
2
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a query. ...
3
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a...
2
by: Shannan Casteel via AccessMonster.com | last post by:
I have a simple invoice form with a subform that allows the user to list part numbers along with the quantity. The subform has a calculated field called that should take either the or the and...
1
by: bcreighton | last post by:
I have created a bound subform on an unbound masterform linked together with a common field (A store's identification number) using an unbound combobox on the masterform and an invisible field on...
10
by: Tweek | last post by:
Hi all, Questions simialar to this have been asked but i haven't found an anwser yet (first post so please don't shoot me) Ok here it goes: I have a subform (view is Continuous Form) which...
1
by: Tgavin8 | last post by:
Hi I am currently attempting to build a databse for a clothing company. The price can differ for this company depending on the size so in the products table I have the sizes listed in a subform...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.