Visual Basic Issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • john in fl

    #1

    Visual Basic Issue

    Hello,
    I created an Access97 database wich I just updated to Access 2000. This
    database had a form that ran a VB event procedure on the current
    record. This procedure prevented editing if a certain field in the
    table was "y" or "Y". This form now fails to work in Access2000, giving
    me an error of "Compile Error: Can't find object or library". The
    debugger also highlights the "LCase" function in the event procedure.
    Consulting the help function, the "LCase" function still exists in
    Access 2000. As a test, I deleted the LCase reference, and the event
    procedure did not produce an error; unfortunantly the LCase function is
    essential for the database. I am stumped as to how to fix this. Any
    help greatly appreciated...t hanks in advance.

    Here is the event procedure in its entirety.
    Private Sub Form_Current()
    If LCase(Text66.Va lue) = "y" Then
    [Combo54].Locked = True
    [Combo56].Locked = True
    [Expense Description].Locked = True
    [Text46].Locked = True
    [Combo71].Locked = True
    [Field38].Locked = True
    [Field31].Locked = True
    [Combo63].Locked = True
    [Amount].Locked = True
    [Text48].Locked = True
    Form.AllowDelet ions = False
    Else
    [Combo54].Locked = False
    [Combo56].Locked = False
    [Expense Description].Locked = False
    [Text46].Locked = False
    [Combo71].Locked = False
    [Field38].Locked = False
    [Field31].Locked = False
    [Combo63].Locked = False
    [Amount].Locked = False
    [Text48].Locked = False
    Form.AllowDelet ions = True
    End If
    End Sub

  • john in fl

    #2
    Re: Visual Basic Issue

    Uhhh...ok, I easily fixed it with the rather obvious solution of an
    "Or" statement.

    Sorry, duhhh.

    Still, any insights as to why the function didn't work appreciated. I'm
    always willing to learn...

    Comment

    • Larry Linson

      #3
      Re: Visual Basic Issue

      Did you set a reference to the DAO 3.6 Library, and qualify your use of DAO
      objects, such as

      Dim rs as Recordset (works swimmingly in A97)

      to

      Dim rs as DAO.Recordset (works swimmingly in later versions provided you
      set the reference).

      To set the reference, open a module Window and on the Menu of that Window,
      Tools | References. Scroll down the reference list until you find DAO 3.6
      Library and check it. If you fear you might miss an occurrence of a DAO
      object, you can move it above the ADO reference in the reference list.

      But, because DAO and ADO share some object names (though the objects
      themselves are differen), it is always good to "disambigua te" by using the
      DAO. or ADO. in the Dim statement.

      Larry Linson
      Microsoft Access MVP
      "john in fl" <john.caserta@m edtronic.com> wrote in message
      news:1138316348 .588603.223850@ z14g2000cwz.goo glegroups.com.. .[color=blue]
      > Uhhh...ok, I easily fixed it with the rather obvious solution of an
      > "Or" statement.
      >
      > Sorry, duhhh.
      >
      > Still, any insights as to why the function didn't work appreciated. I'm
      > always willing to learn...
      >[/color]


      Comment

      Working...