Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / May 2008

Tip: Looking for answers? Try searching our database.

ListBox problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
charles@home.com - 19 May 2008 10:19 GMT
I have a table called MyType
with 2 columns  "MainType" and "SubType"

The table "MyType" ....
"MainType"     "SubType"
Document     Book
Document     Magazine
Document     Newspaper
Video           Film
Video           Tape

I need to create a form called with 2 listboxes.
List0 shows the "DISTINCT MainType" from the table
so it shows only "Document" and "Video"

The other listbox should show the matching subType
e.g.
When "Document" is selected in List0
List1 shows "Book, Magazine and Newspaper"
When "Video" is selected in List0
List1 should show only "Film and Tape"

I can get the first listBox to work but not the second. and I have
spent some hours trying.

Can anyone tell me what I am doing wrong?
SQL List0:-
SELECT DISTINCT MyType.MainType
FROM MyType;

SQL List1:-
SELECT DISTINCTROW MyType.SubType
FROM myType
WHERE (((MyType.MainType) Like [forms]![frmType]![List0]));

Thanks

Charles W
Douglas J. Steele - 19 May 2008 11:42 GMT
On the face of it, your SQL statement should be working. When you say that
you can't get it to work, what do you mean? Do you get an error? If so,
what's the error? If you don't get an error, what's happening?

You might also take a look at
http://office.microsoft.com/en-ca/access/HA011730581033.aspx?pid=CH063650361033

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I have a table called MyType
> with 2 columns  "MainType" and "SubType"
[quoted text clipped - 34 lines]
>
> Charles W
charles@home.com - 19 May 2008 14:11 GMT
I dont get an error.
The First listbox displays correctly.
When I click on the first box it Highlights the line of text.

The second listbox is empty. When I click on it
I get an dotted "outline" of where the first line text should be.

Is these some kind of refresh or update mechanism that I am
missing where the second listbox gets refreshed or updated
using the "OnClick event" of the first listBox?

Charles W

> On the face of it, your SQL statement should be working. When you say that
> you can't get it to work, what do you mean? Do you get an error? If so,
[quoted text clipped - 41 lines]
>>
>> Charles W
Duane Hookom - 19 May 2008 17:41 GMT
You need to requery the second list box after the update of the first list
box.

Sub RqryList1()
   Me.List1.Requery
End Sub

You can call this sub in the On Current of the form and the after update of
List0.

BTW: take the time to name your controls ;-)
Signature

Duane Hookom
Microsoft Access MVP

> I dont get an error.
> The First listbox displays correctly.
[quoted text clipped - 54 lines]
> >>
> >> Charles W
charles@home.com - 22 May 2008 08:36 GMT
Thanks.

That worked.

Charles W

> You need to requery the second list box after the update of the first list
> box.
[quoted text clipped - 68 lines]
>> >>
>> >> Charles W
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.