Results 1 to 5 of 5
  1. #1
    P5C768 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2009
    Location
    Denver, CO
    Posts
    95

    Filter or FindRecord in Split Form

    I'm trying to use a unbound combobox with a ID and Name field (only displaying name) on a split form that will apply a filter or use findrecord in the afterupdate event of the combobox to go to the record in the split form selected by the combo box. Findrecord wasn't working, so I tried filter using this code:



    Code:
    Private Sub Combo11_AfterUpdate()
        Me.Filter = "Supervisor_ID=" & Me.Combo11 & ""
        Me.FilterOn = True
    End Sub
    But it prompts for the supervisor ID, even though the code shows that the value passed should be correct. If I manually enter the ID in the prompt, the filter applies as how I was expecting the code would work. Any insight? Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Is the ID column the BoundColumn? Is the supervisor ID a text or number datatype?

    If number:
    Me.Filter = "Supervisor_ID=" & Me.Combo11

    If text:
    Me.Filter = "Supervisor_ID='" & Me.Combo11 & "'"

    Just to keep in mind, if value is a date:
    Me.Filter = "datefield=#" & Me.Combo11 & "#"
    Last edited by June7; 03-19-2012 at 03:09 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    P5C768 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2009
    Location
    Denver, CO
    Posts
    95
    Yes, the ID is the bound column and yes, the field is text (alphanumeric data). When I changed the coding to what you have above (added apostrophes), it looks like it is referencing the item number of the combo box rather than the value. I tried adding .value with no avail.

  4. #4
    P5C768 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2009
    Location
    Denver, CO
    Posts
    95
    Sorry, I just realized the bound column was wrond after all. I always forget the first column is 0, not 1. Working perfectly now. One further question, I wanted to use a field containing employee name on the split form to allow users to click on the name and move to another form. I'm trying to learn more about embedded macros so i tried usijng that method, but I can't get the macro to activate the record clicked on, it just goes to the first record. Any thoughts? I tried using the same coding that I used to filter the split form.

    Employee_frm, Form, , "Supervisor_ID='" & [Forms]![Supervisor_frm]![Employee_ID] & "'", , Dialog

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    It works? BoundColumn property numbering starts with 1, not 0. Column index reference starts with 0. Not understanding what you mean by 'item number of the combobox'.

    Don't know. I don't use macros. I would have to analyse the project if you want to provide it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 28
    Last Post: 03-08-2012, 06:47 PM
  2. Replies: 1
    Last Post: 12-12-2011, 01:58 PM
  3. Referencing split form data / filter
    By stephenaa5 in forum Programming
    Replies: 2
    Last Post: 09-14-2010, 08:48 AM
  4. Replies: 1
    Last Post: 04-27-2010, 09:30 PM
  5. Can you use a parameter in findrecord?
    By P5C768 in forum Programming
    Replies: 2
    Last Post: 08-20-2009, 04:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums