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?
mbizupConnect With a Mentor Commented:
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)
Clive BeatonAccess DeveloperAuthor Commented:
VBA.Left worked.  Thank you very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.