473,810 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select INTO ListBox

I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search
Button and that will do a select from a PersonData Table that I have filled
out and look at each MemberAlias column for each Person on the Table. It
will then retrieve any persons with that MemberAlias and populate it into a
ListBox, where they can then select the record from that list box and it will
open a "Chart" for that person. I have a ListBox now that runs off of a
SQL Statement query that has hard coded the alias that it should look for.
This pulls back the row and all of the fields and when I click on that row, I
can open the record. How can I write the SQL behind a "Search" button that
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #1
8 2433
daddydfsu via AccessMonster.c om wrote:
I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search
Button and that will do a select from a PersonData Table that I have filled
out and look at each MemberAlias column for each Person on the Table. It
will then retrieve any persons with that MemberAlias and populate it into a
ListBox, where they can then select the record from that list box and it will
open a "Chart" for that person. I have a ListBox now that runs off of a
SQL Statement query that has hard coded the alias that it should look for.
This pulls back the row and all of the fields and when I click on that row, I
can open the record. How can I write the SQL behind a "Search" button that
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.

Create the listbox. In the row source (under Data tab) create the query
to list the fields in the listbox. Let's say your form name is called
Form1. The textbox is called MemberAlias. The Listbox is called
Listbox1. Under the MemberAlias field in the SQL enter
Forms!Form1!Mem berAlias

This will now filter the listbox to the alias you entered.

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery
Dec 7 '05 #2
Okay, this looks similar to what I have. Couple questions:

When you state, "under the MemberAlias field" how do you mean. Is it this:

Select *
from Person
where (MemberAlias = '[Forms]![Form1]![MemberAlias]')

Next Question:

Which Event to I place the AfterUpdate into? The textbox, the search button.
thanks so much.

salad wrote:
I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search

[quoted text clipped - 8 lines]
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.


Create the listbox. In the row source (under Data tab) create the query
to list the fields in the listbox. Let's say your form name is called
Form1. The textbox is called MemberAlias. The Listbox is called
Listbox1. Under the MemberAlias field in the SQL enter
Forms!Form1!Mem berAlias

This will now filter the listbox to the alias you entered.

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #3
Also, do I put this in the Criteria Column in the SQL Query Builder.
[Forms]![Form1]![MemberAlias]

salad wrote:
I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search

[quoted text clipped - 8 lines]
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.


Create the listbox. In the row source (under Data tab) create the query
to list the fields in the listbox. Let's say your form name is called
Form1. The textbox is called MemberAlias. The Listbox is called
Listbox1. Under the MemberAlias field in the SQL enter
Forms!Form1!Mem berAlias

This will now filter the listbox to the alias you entered.

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #4
daddydfsu via AccessMonster.c om wrote:
Okay, this looks similar to what I have. Couple questions:

When you state, "under the MemberAlias field" how do you mean. Is it this:

Select *
from Person
where (MemberAlias = '[Forms]![Form1]![MemberAlias]')
In the Querybuilder, on the Criteria row, enter
[Forms]![Form1]![MemberAlias]

That's basically what you have.

Next Question:

Which Event to I place the AfterUpdate into? The textbox, the search button.
I'm not sure why you have a Search button. If I entered something in
the text box I'd want to update the list. If using a button, put it in
the OnClick event.


thanks so much.

salad wrote:
I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search


[quoted text clipped - 8 lines]
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.


Create the listbox. In the row source (under Data tab) create the query
to list the fields in the listbox. Let's say your form name is called
Form1. The textbox is called MemberAlias. The Listbox is called
Listbox1. Under the MemberAlias field in the SQL enter
Forms!Form1!Mem berAlias

This will now filter the listbox to the alias you entered.

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery


Dec 7 '05 #5
daddydfsu via AccessMonster.c om wrote:
Also, do I put this in the Criteria Column in the SQL Query Builder.
[Forms]![Form1]![MemberAlias]
That's what I'd do.

salad wrote:
I am trying to create a ListBox based on a search from a TextBox. I have a
TextBox where I will enter in a MemberAlias. I want to click on a Search


[quoted text clipped - 8 lines]
will use the text from the TextBox and query based on that text. Thanks in
advance for the help.


Create the listbox. In the row source (under Data tab) create the query
to list the fields in the listbox. Let's say your form name is called
Form1. The textbox is called MemberAlias. The Listbox is called
Listbox1. Under the MemberAlias field in the SQL enter
Forms!Form1!Mem berAlias

This will now filter the listbox to the alias you entered.

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery


Dec 7 '05 #6
It looks like I have all of this correct according to what you have posted,
it is just not pulling back the data. I know the query works because I can
hard code the value in and it populates that listbox. I will keep plugging
away at it. Thanks for taking a look at this.

salad wrote:
Okay, this looks similar to what I have. Couple questions:

[quoted text clipped - 3 lines]
from Person
where (MemberAlias = '[Forms]![Form1]![MemberAlias]')


In the Querybuilder, on the Criteria row, enter
[Forms]![Form1]![MemberAlias]

That's basically what you have.
Next Question:

Which Event to I place the AfterUpdate into? The textbox, the search button.


I'm not sure why you have a Search button. If I entered something in
the text box I'd want to update the list. If using a button, put it in
the OnClick event.
thanks so much.

[quoted text clipped - 16 lines]
When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Req uery


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #7
"daddydfsu via AccessMonster.c om" <u16412@uwe> wrote in
news:587d0234e5 2a0@uwe:
When you state, "under the MemberAlias field" how do you mean. Is
it this:

Select *
from Person
where (MemberAlias = '[Forms]![Form1]![MemberAlias]')


Well, you obviously have to replace "Form1" and "MemberAlia s" with
the name of the form your listbox is on and the name of the unbound
control that you are typing the alias into for searching.

That control is the one where the Afterupdate event should be.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Dec 8 '05 #8
Yes, I did do that and replace it with my actual names. and I did have the
Afterupdate in the control, but it was still not working.

David W. Fenton wrote:
When you state, "under the MemberAlias field" how do you mean. Is
it this:

Select *
from Person
where (MemberAlias = '[Forms]![Form1]![MemberAlias]')


Well, you obviously have to replace "Form1" and "MemberAlia s" with
the name of the form your listbox is on and the name of the unbound
control that you are typing the alias into for searching.

That control is the one where the Afterupdate event should be.


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 8 '05 #9

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

Similar topics

4
11267
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting at the top of the list moving down towards the bottom. The problem I was having was that the <select> control was scrolling back to the top of the page after the postback and the user would lose their place in the <select> control forcing them to...
14
2944
by: Jos? | last post by:
This one droves me completely mad. I did not succeed to exploit the track given to me by Bob. I have : three tables : Clubs, Persons and ClubsPersons that join the two first in a many to many relationship. Club has two (2) fields : ClubId (Autonumber) and ClubName (Text). Peoples has two(2) fields : (PersonId (Autonumber) and PersonName (Text) ClubsPersons has two (2) fields : ClubId (LongInteger) and PersonId
4
2771
by: Alienz | last post by:
I have a subform where I have a subform with 20 options to select from. When I set the multiselect property to simple and select multiple options, nothing is stored. I have another table with fieldID and fieldtype and I would like for evertime something is selected in the listbox for a new entry to be created with that fieldtype for the corresponding fieldID which is linked to the main form. Basically, how do I get info from the listbox...
5
6346
by: Lisa | last post by:
Hello, I am new to using recordsets, and i am completly stuck with this one. I am trying to use a multi select list box to write records to a table. Something in my code is causing the same record to be written over and over, for example if I have 4 items selected, it writes the same item 4 times in my table. Here is my code.
1
11586
by: Ahmet Karaca | last post by:
Hi. myds.Reset(); mycommand.SelectCommand.CommandText= "Select att1 from Ing as Ingredient, Pro as Product "+ "where Pro.ad='apple' and Pro.id=Ing.id"; mycommand.Fill(myds, "Product"); // Here is the problem listbox.DataSource = myds.Tables.DefaultView; // Here again listbox.DataTextField = "invid"; // Here again listbox.DataBind(); mycon.Close()
5
4088
by: Matthew Wells | last post by:
I have a listbox set to simple multi select. For this example, users only select one item at a time. I have command buttons on the form for First, Previous, Next, Last, New (record). The form and listbox are unbound. The listbox rowsource is a value list. The list box has about sixty items in it. Each item in the list box corresponds to a record in the database. When a user selects a row in the list box, the record is retrieved. The...
1
4034
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which are not bound, I select from the bottom set and add to the top set which works fine, but now i decide to remove an item from the top set. when i tried to use a remove item code it worked fine, it did delete the item form the list but it added...
2
5151
by: billa856 | last post by:
Hi, My Project is in MS Access. In that I have one form in which I have some textboxes,comboboxes and listboxes. Now when I select value from 1st combobox(CustomerID) then it wil generate list for 1st listbox(PalletNo). Now I want to select miltiple values from that 1st listbox(PalletNo). and based upon this selection from 1st listbox(PalletNo) and combobox(CustomerID) I want to generate list for 2nd listbox(PONo). For example ...
4
5136
by: Vincent | last post by:
I have a list box that is bound to a table with many records. I have a select all button that when clicked, obviously, selects all of the items in the list box. However, it takes a fairly long time to select all of the elements because I am simply looping through all of the elements in the list box and setting the selected property to true. I have noticed that if I perform a shift select on the list box, all of the items are rapidly...
17
3146
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note that I am using Allen Browne's multi-select list box for a report as a guide. I should also note that my access skills are not the best so I may need some explaining on certain things. First let me give some background on the database: I have a...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
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 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...
1
10391
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,...
0
10121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
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
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
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...

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.