Frightening problem using Access 2003 code in 2007

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby

    Frightening problem using Access 2003 code in 2007

    Hi
    Can anybody tell me why the VBA code below works fine in Access 2003
    but doesn't work in Access 2007? I do not get any error message, even
    if I put a deliberate error into the code. Also, if I put a debug
    break point in the code, nothing happens. If I add the line msgbox
    "ok" it displays the message box, so I know that it is reading the
    code. This is a frightening problem, because if this doesn't display
    errors, then what other bits of code are not working? This is
    happening on every PC which has Access 2007.

    Here's what should happen - when the user clicks on a list box, it
    takes the value from the item he has clicked on and goes off and finds
    the record which corresponds with the value.

    Private Sub lstCompany_Clic k()
    On Error GoTo err_handler

    DoCmd.GoToRecor d acActiveDataObj ect, , acFirst
    txtNAME.Locked = False
    txtNAME.SetFocu s
    DoCmd.FindRecor d lstCompany.Colu mn(0), acAnywhere, False, , False,
    acCurrent, False
    txtFindCompany. SetFocus
    txtNAME.Locked = True
    txtFindCompany. SetFocus
    Exit Sub

    err_handler:
    MsgBox Err.Number & " " & Err.Description

    Exit Sub

    End Sub

    Thanks a lot for any help

    Colin
  • ARC

    #2
    Re: Frightening problem using Access 2003 code in 2007

    I'm not sure why that would cause an error, however, you can check your vba
    settings to help find the error message.

    Open your code module, then in vba, click on tools, options. Verify that
    error handling is set to "break on all errors". Recompile, and then when you
    run you should at least get an error number / description.

    Hope this helps,

    Andy
    "Bobby" <bobby2@blueyon der.co.ukwrote in message
    news:fb0d539c-9053-4ea0-81af-57e32267479b@60 g2000hsy.google groups.com...
    Hi
    Can anybody tell me why the VBA code below works fine in Access 2003
    but doesn't work in Access 2007? I do not get any error message, even
    if I put a deliberate error into the code. Also, if I put a debug
    break point in the code, nothing happens. If I add the line msgbox
    "ok" it displays the message box, so I know that it is reading the
    code. This is a frightening problem, because if this doesn't display
    errors, then what other bits of code are not working? This is
    happening on every PC which has Access 2007.
    >
    Here's what should happen - when the user clicks on a list box, it
    takes the value from the item he has clicked on and goes off and finds
    the record which corresponds with the value.
    >
    Private Sub lstCompany_Clic k()
    On Error GoTo err_handler
    >
    DoCmd.GoToRecor d acActiveDataObj ect, , acFirst
    txtNAME.Locked = False
    txtNAME.SetFocu s
    DoCmd.FindRecor d lstCompany.Colu mn(0), acAnywhere, False, , False,
    acCurrent, False
    txtFindCompany. SetFocus
    txtNAME.Locked = True
    txtFindCompany. SetFocus
    Exit Sub
    >
    err_handler:
    MsgBox Err.Number & " " & Err.Description
    >
    Exit Sub
    >
    End Sub
    >
    Thanks a lot for any help
    >
    Colin

    Comment

    • Bobby

      #3
      Re: Frightening problem using Access 2003 code in 2007

      On 6 Mar, 15:00, "ARC" <PCES...@PCESof t.invalidwrote:
      I'm not sure why that would cause an error, however, you can check your vba
      settings to help find the error message.
      >
      Open your code module, then in vba, click on tools, options. Verify that
      error handling is set to "break on all errors". Recompile, and then when you
      run you should at least get an error number / description.
      >
      Hope this helps,
      >
      I've just followed your advice. Unfortunately even with "break on all
      errors" set, I still don't get an error from the code.

      Colin

      Comment

      • Bobby

        #4
        Re: Frightening problem using Access 2003 code in 2007

        Interestingly on my PC I get and error message, which is "2142 The
        FindRecord action requires a Find What argument". All other PCs I have
        tried do not display a message. The only difference is, I have both
        2007 and 2003 on my PC.

        So, I have two issues - The error above and more alarmingly (I think!)
        the fact that nobody apart from me is getting error messages. Have we
        just forgotten to tick a box when we setup Access 2007?

        Colin

        Comment

        Working...