Limit or filter a list box on a dropdown list selection

M

Mo

Allen;

I am looking for some code to filter a listbox using a drop down list. My
list box shows several columns.

tag_id; TAG; Description; Manufacturer. for example



I would filter on tagid type where Left string of the first few characters
will indicate the tag type:

Example:

mm03-ty-01 , m% would indicate a motor (Which have own set of reports);
left$(Tagid,1) = m

sg01-FY-02 ; S% would indicate a switch. (all back end tables are in SQL
thus the % for a wild card)

The list is filtered to all possible types that start with an S or M or
anything else.

Then I would use the Selected items to print a report the related report
based on the Tag type.(M for motor

Motors have their own report, switches have own reports Etc. Currently
reports are in word, I'll have to recreate them as access reports as I don't
know how to print on word document straight from Access. At any rate report
select/print criteria is based on the type of the element Id or Tag ID



I would appreciate any help with real code example. .

P.S: I have the print selected list items on a single report working fine,
but not on a designed report in Word. Would it be faster to make these word
forms into Access reports?

Thanks
 
L

Larry Linson

Mo said:
Allen;

I am looking for some code to filter a listbox using a drop down list. My
list box shows several columns.

tag_id; TAG; Description; Manufacturer. for example



I would filter on tagid type where Left string of the first few characters
will indicate the tag type:

Example:

mm03-ty-01 , m% would indicate a motor (Which have own set of reports);
left$(Tagid,1) = m

sg01-FY-02 ; S% would indicate a switch. (all back end tables are in SQL
thus the % for a wild card)

The list is filtered to all possible types that start with an S or M or
anything else.

Then I would use the Selected items to print a report the related report
based on the Tag type.(M for motor

Motors have their own report, switches have own reports Etc. Currently
reports are in word, I'll have to recreate them as access reports as I
don't know how to print on word document straight from Access. At any rate
report select/print criteria is based on the type of the element Id or Tag
ID



I would appreciate any help with real code example. .

P.S: I have the print selected list items on a single report working fine,
but not on a designed report in Word. Would it be faster to make these
word forms into Access reports?

I'm not Allen, and he's somewhat busy at this time, but in the FAQ, you'll
find a topic "Forms: Limit content of combo/list boxes" at
http://www.mvps.org/access/forms/frm0028.htm. And, among my souvenirs at
http://accdevel.tripod.com in "Other Examples", there's "QueryByForm with
Three Combo Boxes -- (Access 97 .MDB format)" to take it one more level
deeper.

Both of these have some "real code".

Generally, we don't do "designed reports in Word" because they are faster or
easier, but because we need the additional formatting features we can use in
Word. Some reports would be much faster to do in Access; others not all
that much faster. If you have the code working to drive Word from Access,
then it seems to me that it'll only be a matter, on the Access side, of
selecting the particular items you want to pass to Word. That's not a very
satisfactory answer, I suspect, but making Word work from within Access is,
IMNSHO, the hardest part.

Larry Linson
Microsoft Office Access MVP
 
M

Mo

Thanks a bunch ! I guess I would replace the combo box with a" list box.row
source = strSQL"
 
L

Larry Linson

Mo said:
Thanks a bunch ! I guess I would replace the
combo box with a" list box.row
source = strSQL"

That is certainly an option.

Combo Boxes are more flexible (e.g, with AutoExpand set to Yes, scrolling
the list as you type), and take less screen real estate when not in use;
List Boxes allow (but don't force you to use) multi-select capability and if
you don't have a multitude of options may allow you to show them all, all
the time.

You can implement similar functionality with a Text Box and a Combo/List
Box, but I've never found a real-world situation where it was better to
force the user to type (correctly) than to allow them to type and/or scroll
and choose.

Larry Linson
Microsoft Office Access MVP
 
M

Margaret

Please visit [email protected]/blog
I am starting up a business and need new customers. Any help that you could
give me, I would really appreciate it. Im not spaming anyone, so please let
me know if there are anyone you know who lives in the london area and would
be interested in the purchase of medical uniforms.

Im trying to get as many customers as i can. i need help tho. Please pass
this email on to whom ever you know who would be interested. I would really
appreciate it.

Here is a little about it:

We are a business that makes Medical Uniforms which are made for Nurse's,
Doctors, and any Medical team that there is out there like PSW's.

You can find more out about it at: [email protected]/blog

We have flexible plans to accommodate growth. All size's, styles and colors
that you can think of

We are located in London, Ontario

Thank you for your time.

Margaret
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top