Error message by Mid([FieldName],3,2)

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

    Error message by Mid([FieldName],3,2)

    Dear reader,



    The following functions gives me some problems: Mid([FieldName],3,2) and
    Left() and Date(). On one pc it works perfect and on the other one an error
    message pop's up "Not a valid instruction". After a disconnecting and than
    reconnecting a VBA library, which was not indicated as broken, the command
    Mid([FieldName];3;2) works correct.



    It looks like a check on broken references is not enough.

    Who knows how I can avoid this errors in the Left(), Mid() en Right()
    instruction.



    Thanks for any help,

    Simon


  • Allen Browne

    #2
    Re: Error message by Mid([FieldName],3,2)

    Access will give these errors if any reference is broken, not just the VBA
    one.

    Not sure what you mean by "disconnect ing" the VBA library. It can't be
    deselected as a reference in an Access database.

    Unregistering it and re-registering it (and the other libraries you are
    using) with Windows might help. Use regsvr32. Details:
    How to identify and solve problems with VBA references in a Microsoft Access database. Includes a listing of the libraries needed for each version of Access.


    The problem could also be caused by an ambiguity, e.g. if there is some
    other object named Mid. If this is the cause, you may be able to work around
    it by explicitly referring to the VBA library in your code, e.g.:
    MyVariable = VBA.Mid([FieldName],3,2)

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Simon" <SvanBeekNL@Ver satel.nlwrote in message
    news:45410d05$0 $8375$bf4948fe@ news.tele2.nl.. .
    Dear reader,
    >
    >
    >
    The following functions gives me some problems: Mid([FieldName],3,2) and
    Left() and Date(). On one pc it works perfect and on the other one an
    error
    message pop's up "Not a valid instruction". After a disconnecting and than
    reconnecting a VBA library, which was not indicated as broken, the command
    Mid([FieldName];3;2) works correct.
    >
    >
    >
    It looks like a check on broken references is not enough.
    >
    Who knows how I can avoid this errors in the Left(), Mid() en Right()
    instruction.
    >
    >
    >
    Thanks for any help,
    >
    Simon

    Comment

    Working...