Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2006
    Posts
    559

    Question Unanswered: Listbox issue & printing

    #1:::

    I have a listbox, which has data from a query in it. HOWEVER, the listbox does not display ALL of the fields that are in the query, even when you go through the 'wizard'. It is checked in the query to "SHOW" also

    The fields in the query:

    1.Task_ID
    2.TaskDescription
    3.Status
    4.DateOriginated
    5.DaysOverdue

    The field that DOES NOT SHOW in the listbox is "TaskDescription" and I've done everything that I know of. All the properties of the columns in the listbox are set to 2", just to make them scroll and see if it'll show. Column heads are shown and there is 5 columns in the listbox.

    Nothing I do makes the field, TaskDescription, show. However, if you run the query, the field of "TaskDescription" DOES show with data.

    Does anyone know why this may happen?

    --------------------------------------------------------------------------
    #2:::

    I have a query, "Reminders", which outputs tasks that are over 7 days old to a form, frmReminders, in a listbox.

    I want to set up this form to allow users to do two things:

    1. Print all the records in the listbox onto a report (summarized) with just the fields listed in the query / listbox of
    - Task_ID
    - Task_Description
    - DateOriginated
    - Status
    - DaysOverdue

    2. Print out all of the records / selected records the user highlights with single-clicks and 'cntrl' with ALL data that is in that record to the report, rptTask

    Does anyone know how to do this? If it can be done at all?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    1#::: What is the datatype of the description?

    2#::: yes, I think it can.

    (Semi) - Pseduo code
    Code:
    Dim strWhere As String
    
    StrWhere = "Task_ID IN ("
    
    For Each SelectedItem In Our SelectedItems
    strWhere = StrWhere & TheSelectedTaskID & ","
    Next SelectedItem
    
    strWhere = Left(strWhere, Len(strWhere) - 1) & ") "
    
    DoCmd.OpenReport "ReportName", acViewPreview, , strWhere
    HTH

    EDIT: If this works and you're going to implement this then I want you to tell me exactly what each line does first! You got that!?
    Last edited by gvee; 05-31-07 at 11:40.
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by georgev
    1#::: What is the datatype of the description?


    2#::: yes, I think it can.


    EDIT: If this works and you're going to implement this then I want you to tell me exactly what each line does first! You got that!?

    The datatype of the 'taskdescription' field, from the original table is set to 'memo' because setting it to 'text' only allows for 255 characters and I know people may go over it. The thing is, that I have other queries, like "Search by Keyword" that it DOES show up on. I checked and made sure that everything was the same and it is, that's why I don't see why it won't show on this.


    As for the coding sir, yes I will try to tell you what it's doing. I like to learn and want to. Even got told by the guy that I work with who is the db administrator for the installation that I know more than him and he's even been coming to me asking me for help!

    SO.....

    THANKS to everyone on the forum for helpin' me learned!


    EDIT:::: Attaching the db WITHOUT the listbox on frmReminders. That way if someone tries to help and create it, they'll see it won't work.
    Attached Files Attached Files
    Last edited by Grafixx01; 05-31-07 at 11:46.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    'taskdescription' field, from the original table is set to 'memo'
    There lies your problem! Listboxes can't show memo fields - but have no fear!
    You can use the SQL CONVERT function to convert this field to eg char(50) IN your query. (make sure you trim the field to fit )

    Oh I'll point out now that the loop is wrong - but it should give you an idea of what to do. You may want to try a Do While loop instead of a For Each.
    But who knows - I'll be interested in your solution
    George
    Home | Blog

  5. #5
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by georgev
    There lies your problem! Listboxes can't show memo fields - but have no fear!
    You can use the SQL CONVERT function to convert this field to eg char(50) IN your query. (make sure you trim the field to fit )

    Oh I'll point out now that the loop is wrong - but it should give you an idea of what to do. You may want to try a Do While loop instead of a For Each.
    But who knows - I'll be interested in your solution

    Hmm...Now you're going to make me go look at the other query and see if that has it in it?!? Geez, make me do MORE work! Sheesh! Just playing. Thanks for the input, I'll remember that now.

  6. #6
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by georgev
    There lies your problem! Listboxes can't show memo fields - but have no fear!
    You can use the SQL CONVERT function to convert this field to eg char(50) IN your query. (make sure you trim the field to fit )

    Oh I'll point out now that the loop is wrong - but it should give you an idea of what to do. You may want to try a Do While loop instead of a For Each.
    But who knows - I'll be interested in your solution

    georgev,

    Well, I switched the "TaskDescription" to be a 'text' field rather than a 'memo' field. It just seemed so much easier because I couldn't find any way to use the "CONVERT" statement. The only things I could find had to do with dates and numbers, nothing having to do with string data / words.

    I'm going to work on the other issue now.

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    SELECT SUBSTRING(CONVERT(Char(50), Task_Description),0,11)
    FROM MyTable
    George
    Home | Blog

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I resent the fact taht you've asked q2 a second time in another thread. You can do this - in fact it's not even that hard. If you simply google "Ms access looping through listbox selected" then you will find *plenty* of good code that you can utilise.
    In fact I had a go at coding the above problem and it took a little over 3 minutes (I had to add error handling!)
    Let me know how you get on.
    George
    Home | Blog

  9. #9
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by georgev
    I resent the fact taht you've asked q2 a second time in another thread. You can do this - in fact it's not even that hard. If you simply google "Ms access looping through listbox selected" then you will find *plenty* of good code that you can utilise.
    In fact I had a go at coding the above problem and it took a little over 3 minutes (I had to add error handling!)
    Let me know how you get on.
    george,

    I tried to google it all day yesterday in every way that I could imagine. Although I didn't do it the way you showed with your example though, I thought that it was some thing more simple, just like "SQL CONVERT XXXXX", I didn't know that it was the way you showed. I even asked a bunch of people who I know on my base who use SQL daily and they couldn't even help me out. (asked cause I figured since it was going to be an SQL statement, they'd know)

    I don't know if I double-posted, if I did, my bad. I think that the dual-post you speak of may be a question of why the list boxes show data all the time when i don't want them to until the query is ran. Like how to make them blank, but I'm not sure though.

Posting Permissions

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