473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Partial Display of List Items

10
I have a list box control on an Access 2007 Form called "lstReports". I would like to populate this list box with report names like: rptMaintParts, rptMaintWorkorders, rptMaintParts On Order, etc. However, I do not want the "rptMaint" part of the report name to display in the text box. I once had the code to provide this functionality, but that was many years ago.

I would appreciate it greatly if someone would lead me in the right direction.

Thanks in advance,

Tempo
Jun 10 '11 #1
5 1824
Mihail
759 512MB
In the Property Sheet, under Data tab, set the Row Source Type for your list to Value List. Then use a code like this:

Expand|Select|Wrap|Line Numbers
  1. Dim Rpt As String
  2.     Rpt = Mid("rptMaintParts", 9)
  3.         lst.AddItem (Rpt)
  4.     Rpt = Mid("rptMaintWorkorders", 9)
  5.         lst.AddItem (Rpt)
  6.     Rpt = Mid("rptMaintParts On Order", 9)
  7.         lst.AddItem (Rpt)

Maybe is better to create a function to return the string you need:

Expand|Select|Wrap|Line Numbers
  1. Private function ReturnRaportName(Rpt As String) As String
  2.     ReturnRaportName = = Mid(Rpt, 9)
  3. End Function
Then apply this function:
Expand|Select|Wrap|Line Numbers
  1.     lst.AddItem (ReturnRaportName("rptMaintParts"))
Good luck !
Jun 10 '11 #2
NeoPa
32,556 Expert Mod 16PB
So, you want your ListBox to reflect the names of all reports that start rptMaint, but only to show those parts of the name after rptMaint.

Your code would need to go through all the reports checking for the match then adding the text after the match to the list :

Expand|Select|Wrap|Line Numbers
  1. Dim strList As String
  2. Dim rpt As Report
  3.  
  4. For Each rpt In CurrentProject.AllReports
  5.     If Left(rpt.Name, 8) = "rptMaint" Then _
  6.         strList = strList & "," & Mid(rpt.Name, 9)
  7. End With
  8. Forms!frmBlahBlah.lstReports.RowSource = Mid(strList, 2)
Clearly, Row Source Type for lstReports must already be set to "Value List".
Jun 13 '11 #3
Tempo
10
Hi Guys!

This is to say a "Big Thank You" to both Mihail and NeoPa for each of your responses to my question. The code snippets are definitely a step in the right direction.

Not sure what I need to do to close this thread, but it's a done deal.


Thanks again, Tempo
Jun 17 '11 #4
NeoPa
32,556 Expert Mod 16PB
You're welcome.

See Marking a Post as 'Best Answer'.
Jun 17 '11 #5
Mihail
759 512MB
Glad to help you.
Good luck !
Jun 18 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Peter Collinson | last post by:
Hi... Is there any way to style a List Item a different color and size than the <LI> in an Ordered List? I'd like a red super-script number and a dark blue text in a page's footnotes. And...
2
by: Unknown User | last post by:
How can I separate list items displayed inline by vertical bars | ? If I use a background image that simulate a vertical bar, and I put this bg image behind each list item, the last list item will...
2
by: deepakp | last post by:
Hi, I'm trying to create a site index page. The page layout will consist of a header, left navigation and content display. The left navigation and content display should look like the image file...
0
by: John Dalberg | last post by:
using VS 2005. I have an unordered list with list items which are displayed horizontally. Some of the list items have hyper links and some have checkboxes. The problem is that the...
4
by: parsifal | last post by:
Hi everyone :-) I am learning to use the Repeater control to display a list of data. Each of my list items (or rows, however you look at it) has some child items that are 1..N in length. So I'd...
2
by: Max58kl | last post by:
Hi I am trying to create a bulletted list that has a colored background. The follow css code successfully applies the background color to the list items, but for some reason does not apply the...
1
by: N4t4lie | last post by:
Hi there, I was wondering if anyone could help me? I have a program which has a form that should display 10 items which are held in a list. This program works fine when its created and run as a...
4
by: Keith Hughitt | last post by:
For example, If you have a list: <ul> <li>item 1 is short.</li> <li>item 2 is a little bit longer</li> </ul> regardless of the size of the contents of each list item, the element
0
by: c0mrade | last post by:
I have a problem with getting the list items, below is my hibernate code, after that code there is my method ..and below that is my junit test. How can I make sure that query is executing properly,...
16
Frinavale
by: Frinavale | last post by:
What I'd like to do is take a list and display it's items in a circle. For example (the order of the in the circle doesn't matter..except for Item1, it has to be at the top): Item1 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.