Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    6

    Unanswered: After Update code works for one and not other

    Hello,
    I am new to this so even basic diagnostic help would be great. I've built 3 separate forms with embeded subforms, one for three different types of biologial data. The subform contains data about items found in a samples whereas the form contains data about the sample. When the person goes to enter sample data in the subform, I want them to only be able to select from a set of samples in the parent form (by ID number). I limited the selection to the list and set the sample number as the primary key so there won't be duplicates. I also wrote "after update" code so that when you select the sample number in the form, and associated data shows up in the subform. All three data types (samples) are the same and their underlying tables are formatted the same, but the "after update" code will only work in one of them. I've checked all by names, spelling, relationships, and related code but it still won't work. Have also double checked all the parent-child form-subform definitions.

    my code is:
    Sub cboDUW_ID_no_AfterUpdate()
    Dim rst As DAO.Recordset
    Set rst = Me.RecordsetClone
    rst.FindFirst "[UW ID no] = '" & cboDUW_ID_no.Value & "'"

    If Not rst.NoMatch Then
    MsgBox "Record Found"
    Me.Bookmark = rst.Bookmark
    Else
    MsgBox "Record Not Found."
    End If
    End Sub

    the forms are:
    frm_diet entry (works)
    frm_benthic entry (doesn't work)
    frm_fallout entry (doesn't work)

    The error I get for the two forms that don't work is:
    This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired.
    I've attached the file if anyone wants to take a look. I'm stumped.
    Thanks for any help and Happy New Year,
    Lia
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    When I test it, I get a different error message:

    Visual Basic for Applications (VBA) encountered a problem while attempting to access a property or method. The problem may be one of the following:

    A reference is missing.
    For help restoring missing references, see the Microsoft Knowledge Base article 283806.

    An Expression is misspelled.
    Check all expressions used in event properties for correct spelling.

    A user-defined function is declared as a sub or as a private function in a module.
    Expressions can resolve a user-defined function only if the function is declared as one of the following:
    A public function in a module
    A public or private function in a code module of the current form or report
    Security in Access is set to Medium or High and the Microsoft Jet 4.0 SP8 update is not installed.

    A more recent verion of Jet 4.0 must be installed for Access to function properly when security is set to Medium or High. To obtain the latest version of Microsoft Jet, go to Windows Update.
    I don't have lots of time to analyse atm as I'm on holidays, but hopefully this might steer you in the right direction.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    And just to add to the festive holiday fun, I downloaded and ran the database and and got yet another error message!
    The expression After Update you entered as the event property setting produced the following error:

    A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control.
    With all of this, I think we really need to consider that this might be some exceptionally weird corruption here!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Dec 2008
    Posts
    6

    thanks

    thanks all...I've tried rebuilding the form and run into the same troubles so maybe it's the data (originally from Excel) or some old formatting.

    I'll keep on it. Thanks again,
    Lia

Posting Permissions

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