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 in the subform. Is it
possible? How do I do this? Thanks in advance.
Paul from Slovakia 3 3613
If your subform is unbound (the subform is not using a Table or query as
its recordsource) and you have like a textbox control (or some other
control) then you might think about placing those controls on your main
form. The purpose of a subform is to display data from a table or query
in Datasheet View. The reason for this is because if you select
Datasheet View on the main form, you cannot see your other controls. So
you use a subform in Datasheet view, you place that on your main form as
just another control, along with other controls like a textbox, listbox,
etc.
As for getting data from a listbox:
Text1 = List1.Column(0) 'if you have a one column listbox
Rich
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'd set up the ListBox's RowSource property to return both the product
name and it's price. Hide the Price by setting its column width to
zero. The RowSource SQL would look something like this:
SELECT ProductName, Price FROM Products
The ListBox's ColumnWidths would be something like this:
Column Widths: 1.5";0"
Zero indicates the Price will not show in the ListBox.
I used inches (") - change to whatever metric you normally use.
The following assumes the ListBox is not a multi-select list box (IOW,
only one item can be selected at a time). In the subform controls, pull
the data from the ListBox like this:
ProductName:
The product name is in column zero (1st column in SELECT clause)
ControlSource: =Parent!ListBox Name.Column(0)
Price:
The price is in column 1 (2nd column in SELECT clause)
ControlSource: = Parent!ListBoxN ame.Column(1)
See the Access Help articles on "Parent" and the Column property of the
List/Combo Box controls.
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQUhrVYechKq OuFEgEQJl1wCfeZ +YYg57qs5xkrhcZ +u8X+pxKJoAn0HY
Q+K0OgrXNsOhU1m s+wTjA1e7
=T/DR
-----END PGP SIGNATURE-----
Paul T. Rong wrote: 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 in the subform. Is it possible? How do I do this? Thanks in advance.
Thank you very much MGFoster.
I tried according to our idea, it works only partly. What I really want is,
when one clicks one row of the listbox, the item, say, product name will be
displayed in the subform in the first line together with its unitprice, when
one clicks another row of the listbox, the other product name comes to the
second line with its unitprice too, and so on.
I thought using INSERT INTO would make it possible. I mean to insert records
from the product table (which is the source of the listbox control) into a
query say called "order_detail_q uery" which is the source of the subform.
Howerver, as a beginner on sql, it is tough for me to complete my plan. I
understand your idea and appreciate your help very much. I won't give up.
Maybe it is a good topic, everybody is welcome.
Thanks to Rich too,
Paul
----- Original Message -----
From: "MGFoster" <me@privacy.com >
Newsgroups: comp.databases. ms-access
Sent: Wednesday, September 15, 2004 6:18 PM
Subject: Re: help! pass listbox item to a subform -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd set up the ListBox's RowSource property to return both the product name and it's price. Hide the Price by setting its column width to zero. The RowSource SQL would look something like this:
SELECT ProductName, Price FROM Products
The ListBox's ColumnWidths would be something like this:
Column Widths: 1.5";0"
Zero indicates the Price will not show in the ListBox.
I used inches (") - change to whatever metric you normally use.
The following assumes the ListBox is not a multi-select list box (IOW, only one item can be selected at a time). In the subform controls, pull the data from the ListBox like this:
ProductName: The product name is in column zero (1st column in SELECT clause) ControlSource: =Parent!ListBox Name.Column(0)
Price: The price is in column 1 (2nd column in SELECT clause) ControlSource: = Parent!ListBoxN ame.Column(1)
See the Access Help articles on "Parent" and the Column property of the List/Combo Box controls.
-- MGFoster:::mgf0 0 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBQUhrVYechKq OuFEgEQJl1wCfeZ +YYg57qs5xkrhcZ +u8X+pxKJoAn0HY Q+K0OgrXNsOhU1m s+wTjA1e7 =T/DR -----END PGP SIGNATURE-----
Paul T. Rong wrote:
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 in the subform. Is
it possible? How do I do this? Thanks in advance.
"MGFoster" <me@privacy.com >
??????:QX****** *********@newsr ead1.news.pas.e arthlink.net... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd set up the ListBox's RowSource property to return both the product name and it's price. Hide the Price by setting its column width to zero. The RowSource SQL would look something like this:
SELECT ProductName, Price FROM Products
The ListBox's ColumnWidths would be something like this:
Column Widths: 1.5";0"
Zero indicates the Price will not show in the ListBox.
I used inches (") - change to whatever metric you normally use.
The following assumes the ListBox is not a multi-select list box (IOW, only one item can be selected at a time). In the subform controls, pull the data from the ListBox like this:
ProductName: The product name is in column zero (1st column in SELECT clause) ControlSource: =Parent!ListBox Name.Column(0)
Price: The price is in column 1 (2nd column in SELECT clause) ControlSource: = Parent!ListBoxN ame.Column(1)
See the Access Help articles on "Parent" and the Column property of the List/Combo Box controls.
-- MGFoster:::mgf0 0 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBQUhrVYechKq OuFEgEQJl1wCfeZ +YYg57qs5xkrhcZ +u8X+pxKJoAn0HY Q+K0OgrXNsOhU1m s+wTjA1e7 =T/DR -----END PGP SIGNATURE-----
Paul T. Rong wrote:
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 in the subform. Is
it possible? How do I do this? Thanks in advance. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
After following Microsofts admonition to reformat my system before doing a
final compilation of my app I got many warnings/errors upon compiling an rtf
file created in word. I used the Help Workshop program: hcw.exe that's
included with Visual Basic. This exact same file compiled perfectly with no
notes, warnings or errors prior to reformatting my system. Prior to the
reformatting, I copied the help.rtf file onto a CD and checked the box to...
|
by: Sarir Khamsi |
last post by:
Is there a way to get help the way you get it from the Python
interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the
module cmd.Cmd? I know how to add commands and help text to cmd.Cmd
but I would also like to get the man-page-like help for classes and
functions. Does anyone know how to do that? Thanks.
Sarir
|
by: Sudheer Kareem |
last post by:
Dear All
Please tell me how to assosiate help files with my Vb.net
Project.
Regards
Sudheer
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing result in any way. Who can
help me, I thank you very very much.
list.cpp(main program)
//--------------------------------------------------------------------------
-
#pragma hdrstop
#pragma argsused
|
by: d.warnermurray |
last post by:
I am doing a project for school that involves creating help files for a html
authoring tool.
If you could help me with answers to some questions it would really help.
1. What tasks do you expect an html authoring tool to help you accomplish?
2. What do you expect from online help for a html authoring tool?
3. What audience do you think a freeware html authoring tool is directed
towards?
| |
by: BT Openworld |
last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject)
doesn't work when loaded on Windows XP. I'm finding my way around Access
2003 but my biggest problem is getting information. When I bought Access 1.0
many years ago, I got a paper manual and an excellent help file with all you
needed to know. With Access 97 the manual came as a 'Building Applications'
document on the CD and I still had the excellent help. With Access...
|
by: Corepaul |
last post by:
Missing Help Files
When I enter "recordset" as the keyword and search the Visual Basic Help index,
I get many topics of interest in the resulting list. But there isn't any
information available from clicking on many of the available topics (mostly
methods but some properties are also unavailable). This same problem occurs
with many, if not most, keywords.
Is there any way I can activate these "missing" help topics? HELP!
|
by: Steve |
last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp
My expectation is that a developer using my DLL would be able to access this help file during his development time using "F1" help within the VB IDE. Is this expectation achievable
In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
|
by: JonathanOrlev |
last post by:
Hello everybody,
I wrote this comment in another message of mine, but decided to post it
again as a standalone message.
I think that Microsoft's Office 2003 help system is horrible, probably
the worst I
ever seen.
I almost cannot find anything I need, including things I
|
by: trunxnirvana007 |
last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
'UPGRADE_WARNING: Couldn't resolve default property of object Label. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
Label = New Object(){Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10, Box11,...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |