Complier Error - Expected Array

I copied a function from one ms access databases to another.

The function contains the  following line
      ConnectInfo = Left(ConnectStr, i + 8)

The first db compiles OK.  The second gives a Compile error:  Expected array.

The references are the same for both dbs.

Can anyone help?

Thanks in advance.
Clive BeatonAccess DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you are not familiar with the second database, it is possible that any of your variables are defined as arrays... it could be that one of the variable names you are using is actually defined as a function somewhere in your database... and also less likely but another developer could have written a custom Left function that expects different parameters.

Try a couple of things:

1.  Use different variables:

Dim strConnectInfo as string
dim strConnect as string

strConnect = "THIS IS A TEST"

strConnectInfo = Left(strConnect , i + 8)

Open in new window

2.  If that doesn't type "Left(" in to the VBA Editor.  Intellisense should start prompting you for parameters, letting you know the specific data type.  (Does it look normal?)

Also try searching for Function "Left("
Are there any custom LEFT() functions in the database?

Try replacing this:

>>> strConnectInfo = Left(strConnect , i + 8)

With this:

strConnectInfo = VBA.Left(strConnect , i + 8)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Clive BeatonAccess DeveloperAuthor Commented:
VBA.Left worked.  Thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.