473,320 Members | 1,719 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,320 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 1985
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.