Results 1 to 8 of 8
  1. #1
    thegrimmerdiscovery is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2017
    Posts
    30

    Find Record Combo Box After Update Not Firing

    Hello people




    I’ve been trying to add a combo box find record button to myfledgling database and it’s not working in that the cbo lists the fields I’mexpecting to see in the dropdown but doesn’t execute when clicked. I’mconfident I’ve followed the correct steps (code from Martin Green’s fontstuff) changingonly the rst.FindFirst which is adjusted to my own primary key called ‘ProjRef’.

    Private Sub cboGoToRecord_AfterUpdate()
    On Error Resume Next
    Dim rst AsObject
    Set rst =Me.RecordsetClone
    rst.FindFirst "EmployeeID = " &Me.cboGoToRecord.Value
    Me.Bookmark = rst.Bookmark
    End Sub

    I’ve tried this a ridiculous number of times. The debug doesn’tflag up any issues.
    I’ve also tried to achieve the same goal using the cbowizard option 3 ‘’ Find a record on my form based on the value I selected in mycombo box. The same thing happens – or doesn’t happen, if you see what I mean.I click on any item from the cbo drop down and nothing.
    However, when I’ve tried the cbo wizard option 1 “ I wantthe combo box to get the values from another table or query’ it does work – butit’s an ugy compromise with the data being in the order of the table andshowing the blanks where fields are yet to be populated.
    As I say, I’ve deleted the combobox and created a new one onmany, many occasions but always the same (lack of) result. I’ve tried sourcingit to other tables within the db and nothing happens. The data tab of the propertysheet of the cbo says that ‘enabled: yes; locked: no’. All other features on the form (such as they are) arefunctioning.
    Is there anything I should be looking out for because I’mdesperate for this to work.

    Cheers.

  2. #2
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Is the Employee ID TEXT or NUMERIC?

  3. #3
    thegrimmerdiscovery is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2017
    Posts
    30
    It's a text field

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Gina asked because for Text the syntax would be

    rst.FindFirst "EmployeeID = '" & Me.cboGoToRecord.Value & "'"

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    From HELP:
    Always check the value of the NoMatch property to determine whether the Find operation has succeeded.
    Maybe consider:
    Code:
    Private Sub cboGoToRecord_AfterUpdate()
        On Error Resume Next
    
        ' Dim rst As Object
        Dim rst As DAO.Recordset
        
        Set rst = Me.RecordsetClone
        rst.FindFirst "EmployeeID = '" & Me.cboGoToRecord & "'"
        If Not rst.NoMatch Then
            Me.Bookmark = rst.Bookmark
        Else
            MsgBox "Selection not found"
        End If
        
        'clean up
        Set rst = Nothing
    End Sub

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I'm curious about something. The complaint is that the code doesn't run. OK, there is a syntax error, but once fixed, how would you know it ran? No going to the bookmarked record, no message, no assignment of a recordset field to any control, no debug.print, no message box....
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I'm not sure who that is directed at, but my example code (Post #6) does have a message box if the FindFirst fails to find the search term.......
    The FindFirst shouldn't fail because the search term is from a combo box, but........

    What am I missing???

  8. #8
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Look at the original code, recalling that the original complaint is that it doesn't run. How would you ever know?
    (unless you add a break)

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

Similar Threads

  1. OnClick event not firing on combo
    By GraeagleBill in forum Forms
    Replies: 17
    Last Post: 01-31-2019, 01:57 PM
  2. Combo box On Dbl-Click event not firing
    By GraeagleBill in forum Forms
    Replies: 5
    Last Post: 12-26-2016, 06:45 PM
  3. Replies: 1
    Last Post: 05-26-2014, 12:39 PM
  4. combo box - requery not firing
    By moona in forum Forms
    Replies: 12
    Last Post: 04-20-2013, 06:22 PM
  5. macro: rapid firing of update queries
    By stevepcne in forum Access
    Replies: 1
    Last Post: 11-17-2011, 05:55 PM

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