|
 |
access thread: ListBox in Acces 97
Message #1 by Darryl MacDonald <macdonald.da@b...> on Wed, 15 Jan 2003 13:01:51 -0500
|
|
Hi,
I need to add a large list of Values in Listbox on my form.
The Access Listbox does not support "AddItem"(like a real Listbox) and
the string I need as "Rowsource" is too long.
Any Suggestions?
Thanks
Message #2 by "Steve Klein" <Stephen@K...> on Wed, 15 Jan 2003 18:35:21 -0000
|
|
probably a combo box would be a better bet.
I suggest that you put your list on a table tblRefdataStuff.
Then create a form bound to it so you can add extra data if you wish.
Now use the comboBox wizard and tell it that you are getting your data from
a table ...
I hope that helps I can prbably send you an example direct if it would help.
Steve K
-----Original Message-----
From: Darryl MacDonald [mailto:macdonald.da@b...]
Sent: 15 January 2003 18:02
To: Access
Subject: [access] ListBox in Acces 97
Hi,
I need to add a large list of Values in Listbox on my form.
The Access Listbox does not support "AddItem"(like a real Listbox) and
the string I need as "Rowsource" is too long.
Any Suggestions?
Thanks
Message #3 by "Darryl MacDonald" <macdonald.da@b...> on Thu, 16 Jan 2003 17:11:05
|
|
Thanks Steve,
Actually I need the Multiselect ability of the listbox. The values are a
list of Tables in the Database. Unfortunately I'm new to Databases but
know VB. Maybe a using a Query is what I need?
Darryl M
> probably a combo box would be a better bet.
I suggest that you put your list on a table tblRefdataStuff.
Then create a form bound to it so you can add extra data if you wish.
Now use the comboBox wizard and tell it that you are getting your data from
a table ...
I hope that helps I can prbably send you an example direct if it would
help.
Steve K
-----Original Message-----
From: Darryl MacDonald [mailto:macdonald.da@b...]
Sent: 15 January 2003 18:02
To: Access
Subject: [access] ListBox in Acces 97
Hi,
I need to add a large list of Values in Listbox on my form.
The Access Listbox does not support "AddItem"(like a real Listbox) and
the string I need as "Rowsource" is too long.
Any Suggestions?
Thanks
Message #4 by "Charlie Goodwin" <cgoodwin@c...> on Thu, 16 Jan 2003 13:23:02 -0500
|
|
Darryl,
To populate your listbox with a list of all tables in your DB,
Create your new listbox in Design View
Right Click on the Listbox
Open up Properties for the listbox
Click on the Data Tab
Set RowSourceType to Table/Query
Paste the following SQL below into the RowSource of your listbox:
SELECT MsysObjects.Name
FROM MsysObjects
WHERE (((Left$([Name],1))<>"~") AND ((Left$([Name],4))<>"MSys") AND ((MsysO
bjects.Type)=3D1))
ORDER BY MsysObjects.Name;
Then, click on the Other tab of the Properties Dialog
Select Simple or Extended to choose how you want to multi select
You should now have a listbox that will display a list of all tables in the
DB, and allow multi selection.
Or
If you prefer to have a query as the RowSource,
Go to the Database Window
Select queries
Create a new blank query
Open the SQL view by choosing View > SQL View from a dropdown at the top
Paste the SQL text above into that window
Click Save
Name it
OK it
Then
Go back to your new listbox and it's properties
Set RowSourceType to Table/Query
Enter the name of your new query into the line for the list box's RowSource
Then, click on the Other tab of the Properties Dialog
Select Simple or Extended to choose how you want to multi select
Voila...
That should get you started.
Charlie
> Thanks Steve,
>
> Actually I need the Multiselect ability of the listbox. The values are a
> list of Tables in the Database. Unfortunately I'm new to Databases but
> know VB. Maybe a using a Query is what I need?
>
> Darryl M
>
> > probably a combo box would be a better bet.
> I suggest that you put your list on a table tblRefdataStuff.
> Then create a form bound to it so you can add extra data if you wish.
> Now use the comboBox wizard and tell it that you are getting your data fr
om
> a table ...
>
> I hope that helps I can prbably send you an example direct if it would
> help.
>
>
>
> Steve K
>
>
> -----Original Message-----
> From: Darryl MacDonald [mailto:macdonald.da@b...]
> Sent: 15 January 2003 18:02
> To: Access
> Subject: [access] ListBox in Acces 97
>
>
> Hi,
> I need to add a large list of Values in Listbox on my form.
>
> The Access Listbox does not support "AddItem"(like a real Listbox) and
> the string I need as "Rowsource" is too long.
>
> Any Suggestions?
> Thanks
>
>
Message #5 by "Derrick Flores" <derrickflores@s...> on Sat, 18 Jan 2003 21:00:48 -0600
|
|
Here's some code that will load your tables into a list box. Either place it
in the Form Load Event or on a command button.
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
For Each obj In dbs.AllTables
If Left(obj.Name, 4) <> "MSys" Then
Me.List1.AddItem obj.Name
End If
Next obj
Good Luck,
Derrick Flores
San Antonio, TX
----- Original Message -----
From: "Darryl MacDonald" <macdonald.da@b...>
To: "Access" <access@p...>
Sent: Thursday, January 16, 2003 5:11 PM
Subject: [access] RE: ListBox in Acces 97
> Thanks Steve,
>
> Actually I need the Multiselect ability of the listbox. The values are a
> list of Tables in the Database. Unfortunately I'm new to Databases but
> know VB. Maybe a using a Query is what I need?
>
> Darryl M
>
> > probably a combo box would be a better bet.
> I suggest that you put your list on a table tblRefdataStuff.
> Then create a form bound to it so you can add extra data if you wish.
> Now use the comboBox wizard and tell it that you are getting your data
from
> a table ...
>
> I hope that helps I can prbably send you an example direct if it would
> help.
>
>
>
> Steve K
>
>
> -----Original Message-----
> From: Darryl MacDonald [mailto:macdonald.da@b...]
> Sent: 15 January 2003 18:02
> To: Access
> Subject: [access] ListBox in Acces 97
>
>
> Hi,
> I need to add a large list of Values in Listbox on my form.
>
> The Access Listbox does not support "AddItem"(like a real Listbox) and
> the string I need as "Rowsource" is too long.
>
> Any Suggestions?
> Thanks
>
>
Message #6 by "bwarehouse" <bwarehouse@y...> on Sun, 19 Jan 2003 15:04:23 -0700
|
|
try the AddNew instead.
later,
bware
-----Original Message-----
From: Darryl MacDonald [mailto:macdonald.da@b...]
Sent: Wednesday, January 15, 2003 11:02 AM
To: Access
Subject: [access] ListBox in Acces 97
Hi,
I need to add a large list of Values in Listbox on my form.
The Access Listbox does not support "AddItem"(like a real Listbox) and
the string I need as "Rowsource" is too long.
Any Suggestions?
Thanks
|
|
 |