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

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.com
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #1
8 2398
daddydfsu via AccessMonster.com 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!MemberAlias

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

When you enter an alias, in the AfterUpdate event enter
Me.ListBox1.Requery
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!MemberAlias

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

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


--
Message posted via AccessMonster.com
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!MemberAlias

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

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


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #4
daddydfsu via AccessMonster.com 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!MemberAlias

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

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


Dec 7 '05 #5
daddydfsu via AccessMonster.com 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!MemberAlias

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

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


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.Requery


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200512/1
Dec 7 '05 #7
"daddydfsu via AccessMonster.com" <u16412@uwe> wrote in
news:587d0234e52a0@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 "MemberAlias" 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 "MemberAlias" 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.com
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
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...
14
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...
4
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...
5
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...
1
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...
5
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...
1
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...
2
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...
4
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...
17
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...
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
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...
1
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.