LIST BOX ISSUES

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
Easiest approach is to have the recordsource of your list box contain all of
the fields of interest: base the list box on a query, say, that returns the
other fields, even if you only display one field in the list box.

Then, in the AfterUpdate event of the box, you can refer to the other
columns (whether or not they're visible), and display their values in your
other text boxes.

Assuming the listbox is not multiselect, you'd use code like:

Me.Text1 = Me.MyListBox.Column(1)
Me.Text2 = Me.MyListBox.Column(2)

That will take the values from the 2nd and 3rd column respectively: Column
numbering starts at 0.
 
Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
 
Thank you, Ofer!

It almost worked, I'm still working out the little bugs. One other questions
if I may. How do I make my list box sort in alphabetical order?

Thanks!!!

Ofer said:
Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
--
I hope that helped
Good luck


Faze said:
Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
Hi, Sergeant.
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form.

An autolookup query would probably work in this situation. Please see the
step-by-step tutorial, "How to “auto-complete†a form, with and without code"
on the following Web page:

http://www.Access.QBuilt.com/html/forms.html#AutoCompleteForm

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Hi, Sergeant.

I neglected to mention that you may replace the combo box with a list box in
the example tutorial, and instead of using the tblContractors table as the
Row Source for the list box, create a query such as the following instead:

SELECT ContractorID, ContractorName
FROM tblContractors
ORDER BY ContractorName;

Save this query and then select this query name in the list box's Row Source
Property when the form is in Design View. The contractors will be listed
alphabetically in the list box when the form is in Form View.

As you can see, not one line of VBA code is necessary.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
You can make the order by any field you would like, selecting in at the row
source of the list box

Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name]

That will sort the list box by person name Ascending, to sort Descecnding
you have to specify
Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name] Desc

--
I hope that helped
Good luck


Faze said:
Thank you, Ofer!

It almost worked, I'm still working out the little bugs. One other questions
if I may. How do I make my list box sort in alphabetical order?

Thanks!!!

Ofer said:
Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
--
I hope that helped
Good luck


Faze said:
Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
Thanks, Ofer!

I have one other question. I am very confused as to when one should make
another table? Is it advisable to make more tables or to keep all information
in one? As you can tell I'm learning Access as I go, and without books it's
tough :) I do appreciate all the help. Thanks!

SGT Todika

Ofer said:
You can make the order by any field you would like, selecting in at the row
source of the list box

Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name]

That will sort the list box by person name Ascending, to sort Descecnding
you have to specify
Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name] Desc

--
I hope that helped
Good luck


Faze said:
Thank you, Ofer!

It almost worked, I'm still working out the little bugs. One other questions
if I may. How do I make my list box sort in alphabetical order?

Thanks!!!

Ofer said:
Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
--
I hope that helped
Good luck


:

Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
The issue you are looking for it's normalization, look at this link

http://support.microsoft.com/default.aspx?scid=kb;en-us;100139

There are more links related to this subject.
So you'll have an idea how to design your DataBase
--
I hope that helped
Good luck


Faze said:
Thanks, Ofer!

I have one other question. I am very confused as to when one should make
another table? Is it advisable to make more tables or to keep all information
in one? As you can tell I'm learning Access as I go, and without books it's
tough :) I do appreciate all the help. Thanks!

SGT Todika

Ofer said:
You can make the order by any field you would like, selecting in at the row
source of the list box

Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name]

That will sort the list box by person name Ascending, to sort Descecnding
you have to specify
Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name] Desc

--
I hope that helped
Good luck


Faze said:
Thank you, Ofer!

It almost worked, I'm still working out the little bugs. One other questions
if I may. How do I make my list box sort in alphabetical order?

Thanks!!!

:

Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
--
I hope that helped
Good luck


:

Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
Here’s what I did to automate the form for populating all the data. Build
your table first, then once the table is how you want it, build a query with
all of the fields that you want populated when choosing it in the combo box.
Save the query and when you are creating your from, right click on the little
box in the upper left hand corner between the horizontal and vertical ruler.
After you right click on the box go to “Properties†Choose the “Data Tab†and
select the first line which should be “Data Source†and point that to your
Query. After that’s done, a box should open up and then just drag and drop
the fields you want on your form. Don’t forget to create at least one combo
box and that source control is going to be the same query.

Ofer said:
The issue you are looking for it's normalization, look at this link

http://support.microsoft.com/default.aspx?scid=kb;en-us;100139

There are more links related to this subject.
So you'll have an idea how to design your DataBase
--
I hope that helped
Good luck


Faze said:
Thanks, Ofer!

I have one other question. I am very confused as to when one should make
another table? Is it advisable to make more tables or to keep all information
in one? As you can tell I'm learning Access as I go, and without books it's
tough :) I do appreciate all the help. Thanks!

SGT Todika

Ofer said:
You can make the order by any field you would like, selecting in at the row
source of the list box

Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name]

That will sort the list box by person name Ascending, to sort Descecnding
you have to specify
Select [Person Name] , Address, Phone, Fax From TableName Order By [Person
Name] Desc

--
I hope that helped
Good luck


:

Thank you, Ofer!

It almost worked, I'm still working out the little bugs. One other questions
if I may. How do I make my list box sort in alphabetical order?

Thanks!!!

:

Include all the fields that you want to display in the form in the row source
of the list box
Select [Person Name] , Address, Phone, Fax From TableName

On the after update event of the list box, you can write the code
Me.Address = Me.ListBoxName.Column(1)
Me.Phone = Me.ListBoxName.Column(2)
Me.Fax = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the Address field
=[ListBoxName].Column(1)

In the Address field
=[Phone].Column(2)

The column number of the list box start with 0 and up
--
I hope that helped
Good luck


:

Hello :)
I'm trying to make a list box in Access to where when you click on the name
of the person in the list box, his/her information from the table fills in
automatically in other boxes on the form. Could someone please give me a
link, answer that question or direct me to where i can find this information
please? I am in the Army in Iraq and it's kind of hard to find books here, so
the only info I can access is on the internet. Many thanks ahead of time for
your help! If you email me, please use the email address below. Thanks! :)

V/R,
Dimitri Todika
SGT, USA
1/3 ACR
(e-mail address removed)
 
Back
Top