Query column names as LIST BOX content

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anjani
    New Member
    • Dec 2012
    • 12

    Query column names as LIST BOX content

    Hello,
    I have a Main Form named DATA and a Subform named SPEC. A query named DATA QUERY saves all the data from both the forms.

    I am making a new form named FORM1 which has a LIST BOX named LIST1. I use LIST BOX WIZARD to create the same. I use QUERY to populate this list box.

    The problem is that LIST1 is populated with the data of the QUERY and not the COLUMN NAMES of the DATA QUERY.
    Kindly help.
    Thanks in advance.
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    You need to set the listbox' Row Source TYPE property to FIELD LIST. That will give you the column names instead of the data.


    Using the same query for both your form and your subform sounds "off" to me. Do you have a good reason to do so?

    Comment

    • Anjani
      New Member
      • Dec 2012
      • 12

      #3
      Thanks for your swift reply.

      Same query for Main and Sub Forms is the demand of my project.

      My Query has 15 Columns in total. When i set the Row Source Type property to FIELD LIST (Shown in Untitled1.jpg), it still shows 15 columns and value of each column is converted into Column Names (Shown in Untitled2.jpg).

      [imgnothumb]http://bytes.com/attachments/attachment/6849d1358538856/untitled1.jpg[/imgnothumb]

      [imgnothumb]http://bytes.com/attachments/attachment/6850d1358538856/untitled2.jpg[/imgnothumb]
      Attached Files
      Last edited by TheSmileyCoder; Jan 18 '13, 10:21 PM.

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        I just knocked together a sample on my end to make sure I remember correctly, and sorry to say it, but it works as intended on my end. You must have something else going on with the listbox (code for example) or the query.

        Comment

        • Anjani
          New Member
          • Dec 2012
          • 12

          #5
          Oops!!! I made a boo boo... Column Count was set to 15 and hence i was facing this problem.. thank you TheSmileyCoder, as your confidence made me dig harder into its properties.

          But the problem is that all Column names are transferring from List1 (List Box 1) to List2 (List Box 2) other than the first column name i.e. Project Number. Please help

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            I Presume you mean when you want to "transfer" the columns? Either way that is a "new" question and should be in a new thread, to keep things seperate.

            When you post your question, it would be a good idea to include the same screenshot, as well as any code you have allready tried for the button(s). The SQL behind the listbox query might also prove usefull, so why not include that from the start :)

            Also the images are a bit hard to view, next time zoom in on the important parts :)
            Last edited by TheSmileyCoder; Jan 18 '13, 10:22 PM.

            Comment

            Working...