Results 1 to 4 of 4

Thread: Help!!!

  1. #1
    Join Date
    Feb 2003
    Posts
    107

    Exclamation Unanswered: Help!!!

    Something weird is going on. I spent hours tonight building a database and everything was hunky dory... went to watch a move... then came back and the database wouldn't even open. I was getting a fatal system error. The system gave me a chance to back up the database and then it tried to compact it. But it still couldn't open the database.
    So I created a new database and imported all the objects - tables, forms, modules and macros.
    It seemed to be working fine but when I try to run code that creates an audit log, the system is giving an error that a form called frmInclExclSection1 does not exist. But it does, and so does the Key field that i've specified.
    The code is trying to write to a history table... I got the code from someone on this forum actually, and I know it works. WHen it gets to the line of code with all the *****'s it bombs saying that the form doesn't exist. argh..!
    Please help.

    Public Function basAddHist(Hist As String, frm As String, MyKeyName As String, Optional MyCtrl As Control)
    Dim dbs As DAO.Database
    Dim tblHistTable As DAO.Recordset

    Set dbs = CurrentDb
    Set tblHistTable = dbs.OpenRecordset(Hist, dbOpenDynaset)

    With tblHistTable
    .AddNew
    !mykey = Forms(frm).Controls(MyKeyName) *****
    !MyKeyName = MyKeyName
    !frmName = frm
    !FldName = MyCtrl.ControlSource
    !dtChg = Now()
    !UserId = Environ("Username") 'Orlando's Way
    '!UserId = CurrentUser() 'Mike's way, example of current user would be Admin
    !OldVal = MyCtrl.OldValue
    !NewVal = MyCtrl
    .Update
    End With
    End Function

  2. #2
    Join Date
    Feb 2003
    Posts
    107
    resolved. I was missing a reference to Microsoft office 11 library.
    why didn't it just say so?
    sheesh.

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Was the movie called "The Matrix"? Maybe you haven't woken up yet!!

    The code looks ok to me.

    Check Tools - References when in a code window. There may be a missing reference.
    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

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Bah. Serves me right for leaving on my screen for 12 minutes
    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

Posting Permissions

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