Customize Listbox

mafhobb

Registered User.
Local time
Today, 03:32
Joined
Feb 28, 2006
Messages
1,249
Hi Everyone. I have a not-so-easy question here.

I have a listbox on a form that displays the information I have on two tables (through a query). The first table lists the initial call that a customer makes regarding an issue and the second one the subcalls related to that same issue.

Basically, one call ID can have several subcalls associated with it.

What I want to do is to customize the listbox output so that the SKU,the CallID and the Issue are only displayed on the first line of the specific subcall group.

To help visualizing this, I have attached an unformatted listbox, and a formatted one showing what I'd like the output to be.

Thoughts?

Thanks

Mafhobb
 

Attachments

  • unformatted listbox.JPG
    unformatted listbox.JPG
    42 KB · Views: 96
  • Formatted listbox.JPG
    Formatted listbox.JPG
    33 KB · Views: 94
You can put this in your code module:

Code:
Public Function ShowNoShow(MyText As String, MyID As Long) As String

    Static oldID As Long

    If MyID <> oldID Then
        ShowNoShow = MyText
    Else
        ShowNoShow = ""
    End If

    oldID = MyID

End Function
and add it as a calculated field in the query for each field you wish to make disappear.

It will output "" if the value of MyID is the same as in previous record, or output MyText if it differs. Adjust datatype MyID to fit your situation, and if not all values are strings then perhaps change the datatype of the function to variant
 
Last edited:
How do I add this as a calculated field in my query? I only know how to add simple criteria, not this complete code
 
Xverze, could you explain how to do this?

Thanks
 

Users who are viewing this thread

Back
Top Bottom