listbox problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • indhu
    New Member
    • Oct 2006
    • 140

    #1

    listbox problem

    Hi all,

    not helping me.

    i ve form where one listbox and 4 textboxes. all the records am fetching from task table. in the list box i ve the staff names.. when i click that name the corresponding data has to retrieve from table and display it in the 4 textboxes.

    one more thing. i ve entered staff names many times in the table becos they do more than one designation of work(modelling, texturing,light ing). so when i click their name it should display all the details of them.

    plse help yeah
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Originally posted by indhu
    Hi all,

    not helping me.

    i ve form where one listbox and 4 textboxes. all the records am fetching from task table. in the list box i ve the staff names.. when i click that name the corresponding data has to retrieve from table and display it in the 4 textboxes.

    one more thing. i ve entered staff names many times in the table becos they do more than one designation of work(modelling, texturing,light ing). so when i click their name it should display all the details of them.

    plse help yeah
    You need to be more specific.

    1. What is your form name
    2. Are the textboxes bound to any control
    3. What exactly is the structure of your table
    4. What is the row source of your listbox
    5. If you have more than one instance of employee name how do you decide which record you want to show
    6. What values exactly do you want in the textboxes and from what source

    Comment

    • indhu
      New Member
      • Oct 2006
      • 140

      #3
      Originally posted by mmccarthy
      You need to be more specific.

      1. What is your form name
      2. Are the textboxes bound to any control
      3. What exactly is the structure of your table
      4. What is the row source of your listbox
      5. If you have more than one instance of employee name how do you decide which record you want to show
      6. What values exactly do you want in the textboxes and from what source

      1. Form4
      2. not bound to any control
      3. It has, object, taskspec, task, startdate, enddate, status, and comments
      4. SELECT DISTINCT task.Person FROM task ORDER BY task.person;
      5. person ="task" field(like modelling, texturing).
      6. same values from task table.


      pls help me

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by indhu
        1. Form4
        2. not bound to any control
        3. It has, object, taskspec, task, startdate, enddate, status, and comments
        4. SELECT DISTINCT task.Person FROM task ORDER BY task.person;
        5. person ="task" field(like modelling, texturing).
        6. same values from task table.
        You don't say what value you want in each textbox as in what fields from the task table you want to use. However, you can see the following example.

        Code:
         
        Private Sub listboxname_AfterUpdate()
         
        Me.textboxname1 = DLookup("object", "task", "person='" & Me.listboxname & "'"
        Me.textboxname2 = DLookup("taskspec", "task", "person=" & Me.listboxname & "'"
         
        'etc.
         
        End Sub

        Comment

        • indhu
          New Member
          • Oct 2006
          • 140

          #5
          Originally posted by mmccarthy
          You don't say what value you want in each textbox as in what fields from the task table you want to use. However, you can see the following example.

          Code:
           
          Private Sub listboxname_AfterUpdate()
           
          Me.textboxname1 = DLookup("object", "task", "person='" & Me.listboxname & "'"
          Me.textboxname2 = DLookup("taskspec", "task", "person=" & Me.listboxname & "'"
           
          'etc.
           
          End Sub
          its displaying syntax error iin query expression missing operator

          only task is changing nothing else

          Me.txt_task = DLookup("task", "task", "person='" & Me.List1 & "'")
          Me.txt_spec = DLookup("Task spec", "task", "person='" & Me.List1 & "'")
          Me.Status = DLookup("status ", "task", "person='" & Me.List1 & "'")
          Me.Startdate = DLookup("startd ate", "task", "person='" & Me.List1 & "'")
          Me.Enddate = DLookup("enddat e", "task", "person='" & Me.List1 & "'")

          giving error when i go to debug text tool tip is showing the exact value..

          help me

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            Try this:

            Me.txt_task = DLookup("[task]", "task", "[person]='" & Me.List1 & "'")
            Me.txt_spec = DLookup("[Task spec]", "task", "[person]='" & Me.List1 & "'")
            Me.Status = DLookup("[status]", "task", "[person]='" & Me.List1 & "'")
            Me.Startdate = DLookup("[startdate]", "task", "[person]='" & Me.List1 & "'")
            Me.Enddate = DLookup("[enddate]", "task", "[person]='" & Me.List1 & "'")

            Comment

            • indhu
              New Member
              • Oct 2006
              • 140

              #7
              Originally posted by mmccarthy
              Try this:

              Me.txt_task = DLookup("[task]", "task", "[person]='" & Me.List1 & "'")
              Me.txt_spec = DLookup("[Task spec]", "task", "[person]='" & Me.List1 & "'")
              Me.Status = DLookup("[status]", "task", "[person]='" & Me.List1 & "'")
              Me.Startdate = DLookup("[startdate]", "task", "[person]='" & Me.List1 & "'")
              Me.Enddate = DLookup("[enddate]", "task", "[person]='" & Me.List1 & "'")
              hi

              thank you, working fine

              Comment

              • indhu
                New Member
                • Oct 2006
                • 140

                #8
                Originally posted by indhu
                hi

                thank you, working fine
                hi

                again problem yeah, its not showing all the datas only 4 datas it displaying.
                i think problem in the person field. "4" person name repeated so many times

                1 person is do many work. I ve repeated person in the table field becos of that only its not displaying all the field. its taking the exact four person annd displying only four fields. How to overcome this problem yeah.

                give me suggestion and help me

                Comment

                • PEB
                  Recognized Expert Top Contributor
                  • Aug 2006
                  • 1418

                  #9
                  Hi,
                  you can add a checking condition like this

                  DLookup("[enddate]", "task", "[person]='" & Me.List1 & "' AND Not ([enddate]) IS null")

                  AND Not ([enddate]) IS null will get information from a field populated with information and isn't empty

                  Do the same for all of your fields!

                  Originally posted by indhu
                  hi

                  again problem yeah, its not showing all the datas only 4 datas it displaying.
                  i think problem in the person field. "4" person name repeated so many times

                  1 person is do many work. I ve repeated person in the table field becos of that only its not displaying all the field. its taking the exact four person annd displying only four fields. How to overcome this problem yeah.

                  give me suggestion and help me

                  Comment

                  Working...