468,554 Members | 1,891 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

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 2223
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by headware | last post: by
14 posts views Thread by Jos? | last post: by
1 post views Thread by Ahmet Karaca | last post: by
5 posts views Thread by Matthew Wells | last post: by
4 posts views Thread by Vincent | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.