Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2002
    Posts
    19

    Unanswered: listbox solution

    Ok, I've come to the conclusion that there must not be a way to print values in my listbox in a report. I have a listbox that is filtered/populated depending on what letters I type in textbox (eg. find all entrie starting with "tri...") For each entry you can double click to open a form that lets you views the details for that entry. Now I want to print this list. I was thinking I would need some sort of loop??? All I want is to create a printout for the list generated, but I can't seem to find an answer. Maybe I should go about this a completely different way? Suggestions?

  2. #2
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey Skate,
    You can do it only if you can match the Reports record source to the listboxes row source. If you use Visual Basic to do all of your SQL you can then apply it to your report. It isn't that hard if you feel comfortable with Visual Basic.

    Later, Kal

  3. #3
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    Skate,

    This somewhat follows what Kal said. If you can find a way to mark the records that are put in your list box as having been selected then you can base a report on a query that gets those selected records. Given that I don't know exactly how you filter the info for the list box, I can't offer any specifics. Hope this helps.

    Steve
    SteveH

  4. #4
    Join Date
    Jun 2002
    Posts
    19
    Sorry, I'm a bit of clutz in VB and don't fully understand this piece of free code that I found, but I used something like this:

    Dim txtSearch as variant
    dim strSQL as string

    txtSearchString = Me![txtSearch].Text

    strSQL = "SELECT [Files].[File Index], Files.[Hot List],[Customer].[Customer ID], [Files].[Project], [Files].[Eng], [Files].[Proposal], [Files].[Mill Company], [Files].[Mill Location], Files.[Detail Desc], files.[Cust PO No] FROM Files INNER JOIN Customer ON [Files].[Customer Index]=[Customer].[Customer Index]"

    strSQL = strSQL & "WHERE ((Files.[Mill Location]) Like '" & txtSearchString & "*') "

    strSQL = strSQL & "ORDER BY Files.[Mill Location]"

    So when the user enters a text the listbox is filled. How do I transfer this info to a report? I don't want to have to select each item in the list because it is not practical so I would assume I could use some sort of loop?

  5. #5
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    Skate,

    I am assuming that the code you posted above works. If so, here is one way to get the info to a report.

    1. Create a new field in the Files table called "Selected" with a data type of Yes/No.

    2. Put this code in along with what you have:

    dim srtSQL2 as String

    srtSQL2 = “UPDATE Files INNER JOIN Customer ON [Files].[Customer Index] = [Customer].[Customer Index] SET Files.Selected = True WHERE ((Files.[Mill Location]) Like '" & txtSearchString & "*')”

    3. Create a query that will retrieve the records where Files.Selected=True. Base your report on that query.

    4. DON'T MISS THIS STEP! Create an update query that resets Files.Selected=False after you have run the report.

    Hope this helps.
    SteveH

  6. #6
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey Skate,
    Try this download. Its a very simple design that you can follow. The filter fields only require you to type in few letters then use refresh to reset the listbox. When you obtain your data, just hit print. Let me know if this helps.

    Later, Kal
    Attached Files Attached Files

  7. #7
    Join Date
    Jun 2002
    Posts
    19
    oh wow, thanks. that db downed helped, it worked perfectly!

  8. #8
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    No Problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •