Adding a query dependant on a form to the same form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Adrian Tache
    New Member
    • Nov 2010
    • 12

    Adding a query dependant on a form to the same form

    All right, let's see if I can explain this.

    I want to have a form contain three things:
    1. an activex calendar which does nothing (except provide a calendar)
    2. a combo box which lists employee names and feeds the selected name to a query which returns dates for that name.
    3. a list box which gets data from the above query and displays it.

    I know how to do 1 and 2. no idea how to get 3 to work...

    to rephrase: i have a table called timesheets. I want to know in which days employees have not filled a timesheet. Seeing as how I can't figure out how to do that I decided to show them the dates they have filled in and a calendar side by side, asking them to be clever enough to figure out where data is missing. the way i want to do this is in a form, to select employee name from a combo box (populated by the employees table) and have that entered into the query as a filter to all timesheet dates. those dates remaining (which match the employee id) should be displayed in a list box in the same form AND be updated at the same time as the combo box.

    any ideas?

    Thanks in advance :)
  • malcolmk
    New Member
    • Sep 2010
    • 79

    #2
    You could do worse than take a look at this!

    Tie listbox to your query, requery listbox on change event of combobox.

    Comment

    • Adrian Tache
      New Member
      • Nov 2010
      • 12

      #3
      thanks for the reply

      my brain is kind of spinning when i read all this

      ok i requeried the listbox but i'm having a new problem and I think I know the cause. my tables are like below:

      Employees (EmployeeID As Autonumber, EmployeeReadabl eID As String, etc.)

      Timesheet (EmployeeReadab leID As number, EmployeeName As String, SheetDate, etc.)

      problem is that from the combo box I choose a name (string) but the dates themselves are linked to an ID (number). tried linking the combo box to the employeename and displaying that as well in the query but that doesn't work...

      I'll just display all the employees and dates in that box, no frills... not elegant or functional but at least I get it to work - sort of...

      Comment

      • malcolmk
        New Member
        • Sep 2010
        • 79

        #4
        Hi Adrian, well I had a go at getting something up and running for you to take a look at. If its te kind of thing you want then maybe you or I can tidy it up a bit. Not the best timesheet tracking example but it's a start.
        Its easy to see what days timesheets have been omitted but could be improved.
        Attached Files

        Comment

        • Adrian Tache
          New Member
          • Nov 2010
          • 12

          #5
          Wow, thanks a lot for your help :)

          Looks really awesome. And I can finally understand how the hell to use the Calendar activex control

          i'm just too tired to look at it though, it'll have to wait till monday

          but awesome stuff man, thanks a bunch! :)

          cheers

          Comment

          Working...