By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Oct 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Access will give these errors if any reference is broken, not just the VBA
one.

Not sure what you mean by "disconnecting" 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:
http://allenbrowne.com/ser-38.html

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" <Sv********@Versatel.nlwrote in message
news:45**********************@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

Oct 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.