473,387 Members | 1,572 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,387 software developers and data experts.

How do I pass the value from a list box into a query?

I've got two tables in my DB, a Client table and an Event table.
There are many events for each client. The form I designed is based
off of the Client table and the subform within it is sourced from the
Event table.

The way things are currently designed places a list of clients on the
left side of the form (with a list box), and then there's a subform on
the right side of the main form with fields to enter event
information.

What I'd like to have happen is to simply select a client name from
the left side, enter the event information on the right and click
submit, and then move on selecting other clients, etc. Right now I
have a list box
providing the client list. Is this right? I know there's an option
when using the listbox wizard that involves using a record selected in
the list box for other functions, but I can't figure out how that
works exactly.

Thanks,
Andrew
Nov 13 '05 #1
5 1988
Andrew,
Rather than the Left side of the form, go to Design View and view the Form
Header/Footer.
If you create a combobox that gets its data from the same source as the
listbox (and use the wizard to create it) The option of "Find a record on
my form..." will be available.
While you don't need to stick with the Combobox, it will show you the
appropriate code to use.
Personally though I would use a combobox for this type of
application....especially if the client list grows to a long long list...a
lot less scrolling with the combobox.

HTH
Mal.

"Andrew" <sp****@gnt.net> wrote in message
news:d8**************************@posting.google.c om...
I've got two tables in my DB, a Client table and an Event table.
There are many events for each client. The form I designed is based
off of the Client table and the subform within it is sourced from the
Event table.

The way things are currently designed places a list of clients on the
left side of the form (with a list box), and then there's a subform on
the right side of the main form with fields to enter event
information.

What I'd like to have happen is to simply select a client name from
the left side, enter the event information on the right and click
submit, and then move on selecting other clients, etc. Right now I
have a list box
providing the client list. Is this right? I know there's an option
when using the listbox wizard that involves using a record selected in
the list box for other functions, but I can't figure out how that
works exactly.

Thanks,
Andrew

Nov 13 '05 #2
Thanks for the help Mal. I'd rather use a list box if possible since
1) the client list will rarely get longer than 25 and 2) the people
using the system will have a much easier time with a list box than a
combo box (not the most computer savvy folks). If I just change the
type from a combo to a list is there anything else I'd have to take
into consideration?

Thanks,
Andrew
"Mal Reeve" <lo*****@earthlink.net> wrote in message news:<5_******************@newsread3.news.atl.eart hlink.net>...
Andrew,
Rather than the Left side of the form, go to Design View and view the Form
Header/Footer.
If you create a combobox that gets its data from the same source as the
listbox (and use the wizard to create it) The option of "Find a record on
my form..." will be available.
While you don't need to stick with the Combobox, it will show you the
appropriate code to use.
Personally though I would use a combobox for this type of
application....especially if the client list grows to a long long list...a
lot less scrolling with the combobox.

HTH
Mal.

Nov 13 '05 #3
I don't think anything else would need changed...

look in help for the .selected
which is what you want....
If its a simple list box (only one selection allowed)
then I think that using the value will work the same way as the code
produced by the wizard.

Mal.

"Andrew" <sp****@gnt.net> wrote in message
news:d8**************************@posting.google.c om...
Thanks for the help Mal. I'd rather use a list box if possible since
1) the client list will rarely get longer than 25 and 2) the people
using the system will have a much easier time with a list box than a
combo box (not the most computer savvy folks). If I just change the
type from a combo to a list is there anything else I'd have to take
into consideration?

Thanks,
Andrew
"Mal Reeve" <lo*****@earthlink.net> wrote in message
news:<5_******************@newsread3.news.atl.eart hlink.net>...
Andrew,
Rather than the Left side of the form, go to Design View and view the
Form
Header/Footer.
If you create a combobox that gets its data from the same source as the
listbox (and use the wizard to create it) The option of "Find a record
on
my form..." will be available.
While you don't need to stick with the Combobox, it will show you the
appropriate code to use.
Personally though I would use a combobox for this type of
application....especially if the client list grows to a long long
list...a
lot less scrolling with the combobox.

HTH
Mal.

Nov 13 '05 #4
Another thought...

Use a combo-box, and the code auto generated....
And use the On Open event of the form to set the combobox as dropped.

txtComboBoxClientList.Dropdown

Making it look an awful lot like a listbox...

Mal.

"Andrew" <sp****@gnt.net> wrote in message
news:d8**************************@posting.google.c om...
Thanks for the help Mal. I'd rather use a list box if possible since
1) the client list will rarely get longer than 25 and 2) the people
using the system will have a much easier time with a list box than a
combo box (not the most computer savvy folks). If I just change the
type from a combo to a list is there anything else I'd have to take
into consideration?

Thanks,
Andrew
"Mal Reeve" <lo*****@earthlink.net> wrote in message
news:<5_******************@newsread3.news.atl.eart hlink.net>...
Andrew,
Rather than the Left side of the form, go to Design View and view the
Form
Header/Footer.
If you create a combobox that gets its data from the same source as the
listbox (and use the wizard to create it) The option of "Find a record
on
my form..." will be available.
While you don't need to stick with the Combobox, it will show you the
appropriate code to use.
Personally though I would use a combobox for this type of
application....especially if the client list grows to a long long
list...a
lot less scrolling with the combobox.

HTH
Mal.

Nov 13 '05 #5
sp****@gnt.net (Andrew) wrote in message news:<d8**************************@posting.google. com>...
I've got two tables in my DB, a Client table and an Event table.
There are many events for each client. The form I designed is based
off of the Client table and the subform within it is sourced from the
Event table.

The way things are currently designed places a list of clients on the
left side of the form (with a list box), and then there's a subform on
the right side of the main form with fields to enter event
information.

What I'd like to have happen is to simply select a client name from
the left side, enter the event information on the right and click
submit, and then move on selecting other clients, etc. Right now I
have a list box
providing the client list. Is this right? I know there's an option
when using the listbox wizard that involves using a record selected in
the list box for other functions, but I can't figure out how that
works exactly.

Thanks,
Andrew

Andrew,
are you sure you want just two tables? Can two people attend the same
event? If so, you need [Person]--[Attends]--[Event]. So Attends
would be something like (PersonID, EventID) with *both* as primary
key. Then if you wanted to have all the events a person is attending
in a listbox and move them back and forth, say between lbxAttending
and lbxNotAttending, you could use the .AddItem, and .RemoveItem
methods of the listbox (assumes 2002 or later). Then if you wanted to
use the selected items in a query, there's code right here...
(it's on www.mvps.org/access somewhere...
right here:
http://www.mvps.org/access/forms/frm0007.htm

basic format of your form
lbxUnselected (one button for add, one for remove) lbxSelected

then use the code from the link to work with your query.

HTH,
Pieter
Nov 13 '05 #6

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

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
3
by: Nath | last post by:
Please help!? I am new to writing html, javascript, pretty new to MySQL but quite proficient at writing Perl and i'm a quick learner. I am building a database driven website and i am a little...
2
by: Jeff Thur | last post by:
I am running a SQL Stored Procedure that will give the user a count of how many records are in the database as per certain criteria. I'm using the Execute Scalar Method. I have no problem passing...
3
by: dk | last post by:
Hi all, Would appreciate some advice on the following: I am trying to speed up an Access database connected to a SQL Server back-end. I know I can use a pass-through query to pass the sql...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
9
by: Alan Silver | last post by:
Hello, I'm a bit surprised at the amount of boilerplate code required to do standard data access in .NET and was looking for a way to improve matters. In Classic ASP, I used to have a common...
10
by: sesling | last post by:
I have created a query that will pull information from our database for the operators. This query will pull in on average 50,000 records. The operators need to refine the search results. I have...
0
by: mimsc | last post by:
This is my database code: public List getListingData() { //clear the list managerList.clear(); //fill the list with new data try { open(); ...
9
by: JRough | last post by:
I tried to pass the $result from a mysql_query in a url like this line Header("Location:clm_historyXL.php?_result=".$result); but on the redirect location clm_history.php page I get an error on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.