Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Multiple Combo Box Find (2002/SP2)

    We have a DB where we track daily activity. I have a combo box to look up the individual forms by date and by shift, we have 3 shifts. I can't get it to work for the shifts and I'm pretty sure that I just don't have it right. I let Access create the lookup for me on the date and I tried to add the shift information. Here is what I have:

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Date] = #" & Format(Me![Combo53], "mm/dd/yyyy") & "#" 'The previous was created by Access and then I added the next part.' & " AND [Shift]"

    I did try several different formats but none of them worked and this was the shortest. Thanks for your help.

  2. #2
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    Don,
    You say "I did try several different formats but none of them worked and this was the shortest." What were you formatting?

    You say you tried adding <span style="background-color: #FFFF00; color: #000000; font-weight: bold">' & " AND [Shift]"</span hi> The & denotes concatenation, where I believe you want to add another search criteria. Try removing the &, to look something like:

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Date] = #" & Format(Me![Combo53], "mm/dd/yyyy") & "#" AND "[SHIFT] = [COMBOSHIFT]"
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    Do you have a separate combo box for the shift? If so, what is its name, and what kind of field is the shift field - text or number?

  4. #4
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    I have one combo box with both Date and Shift. I used the Access Wizard to set it up. The Shift field is numeric. Thanks.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    Can you post the Row Source of the combo box?

  6. #6
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    Absolutely!
    SELECT qryShiftInfo.Date, qryShiftInfo.Shift FROM qryShiftInfo;

    Thanks again.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    OK, try this:

    rs.FindFirst "[Date] = #" & Format(Me![Combo53], "mm/dd/yyyy") & "# AND [Shift] = " & Me.Combo53.Column(1)

    Columns of a combo box are numbered starting at 0, so Combo53.Column(1) is the 2nd column.

  8. #8
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    I copied it and am gettiing a compile error when I try to run it.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    What exactly is highlighted?

  10. #10
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    The error message is :

    Compile Error
    Syntax Error

    and the whole line turns red.

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Combo Box Find (2002/SP2)

    Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

Posting Permissions

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