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

Right turns to RIGHT and I get "Compile Error -Expected Array

P: 3
I am trying to use the Right function in a VB6 program. I have used it used many times before in other programs.

When I press the enter key after entering the code line, the word "Right" turns into "RIGHT" in all capital letters

The line is
[code] LongText = RIGHT(LongText, 2)
I have used Option Explicit to make sure all variables are correct.

When I run the entire program I get an the following error message "Compile error Expected Array " and the word "RIGHT" is highlighted.

To make the problem more interesting, if I replace the word "RIGHT" with "LEFT" i receive no error message.

In addition I have this portion of the program in another program and it works!!!! I have compared programs and see no difference. I have checked the references in both programs and they are the same.

O/S WinXP with VB6
Mar 18 '07 #1
Share this Question
Share on Google+
3 Replies

P: 1,646
Just a quick glance and it looks like RIGHT is declared as an array somewhere in your code. What happens if you do a global search for the word 'right' in your code?
Mar 18 '07 #2

P: 3
You nailed it. I had "RIGHT" as a constant.

Thanks ......
Mar 18 '07 #3

P: 1,646
You nailed it. I had "RIGHT" as a constant.

Thanks ......
You are very welcome
Mar 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.