VBA Won't Capitalize "right"

M

MikeC

Below is a code fragment from a public procedure contained in a standard
code module. I'm using Access 2002 SP3 and my O/S is Windows XP SP2. I
have copied the code directly from the module into this post with no
modifications.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Store the file type extension (.mdb, .mde, .adp, .ade).
strFileType = right(strDB, lngLength - InStrRev(strDB, ".", _
lngLength, vbTextCompare) + 1)

'Create backup database UNC path.
strBUDB = Left(strDB, InStr(strDB, strFileType) - 1) & "_BACKUP" &
strFileType
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The code appears to be working correctly, but for some reason the "r" in
"right" simply refuses to automatically capitalize as "R". Even if I
manually change the "r" to "R", it reverts back to lower case "r". This
behavior is suspicicious. As you can see, the "L" in "Left" is capitalized.

The strange thing is that I copied the entire procedure to one of my other
mdb files on the same machine and the "r" was automatically capitalized as
"R". So, now I'm wondering if there is something wrong with mdb file that
I'm using. I have already performed a compact/repair and a
decompile/recompile and the problem has not gone away. I have also verified
that the selected references are correct.

Has anyone else had this experience?
 
A

Andi Mayer

Below is a code fragment from a public procedure contained in a standard
code module. I'm using Access 2002 SP3 and my O/S is Windows XP SP2. I
have copied the code directly from the module into this post with no
modifications.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Store the file type extension (.mdb, .mde, .adp, .ade).
strFileType = right(strDB, lngLength - InStrRev(strDB, ".", _
lngLength, vbTextCompare) + 1)

'Create backup database UNC path.
strBUDB = Left(strDB, InStr(strDB, strFileType) - 1) & "_BACKUP" &
strFileType
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The code appears to be working correctly, but for some reason the "r" in
"right" simply refuses to automatically capitalize as "R". Even if I
manually change the "r" to "R", it reverts back to lower case "r". This
behavior is suspicicious. As you can see, the "L" in "Left" is capitalized.

The strange thing is that I copied the entire procedure to one of my other
mdb files on the same machine and the "r" was automatically capitalized as
"R". So, now I'm wondering if there is something wrong with mdb file that
I'm using. I have already performed a compact/repair and a
decompile/recompile and the problem has not gone away. I have also verified
that the selected references are correct.

Has anyone else had this experience?

constantly, but I don't care

go down your module and find the last "right", change it there and the
rest get's changed also
 
M

MikeC

Thanks, but that didn't work either. The "R" just reverts back to "r".

Are you saying that this problem is entirely cosmetic and does not indicate
a potentially more serious problem?
 
A

Andi Mayer

Thanks, but that didn't work either. The "R" just reverts back to "r".

Are you saying that this problem is entirely cosmetic and does not indicate
a potentially more serious problem?
yes this is an automatism from VBA

try: ctrl-H such for "right" replace with "Right" then it should work

it could be also that you have a function or a varibale named right
somewhere
 
D

Dirk Goldgar

MikeC said:
Below is a code fragment from a public procedure contained in a
standard code module. I'm using Access 2002 SP3 and my O/S is
Windows XP SP2. I have copied the code directly from the module into
this post with no modifications.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Store the file type extension (.mdb, .mde, .adp, .ade).
strFileType = right(strDB, lngLength - InStrRev(strDB, ".", _
lngLength, vbTextCompare) + 1)

'Create backup database UNC path.
strBUDB = Left(strDB, InStr(strDB, strFileType) - 1) & "_BACKUP" &
strFileType
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The code appears to be working correctly, but for some reason the "r"
in "right" simply refuses to automatically capitalize as "R". Even
if I manually change the "r" to "R", it reverts back to lower case
"r". This behavior is suspicicious. As you can see, the "L" in
"Left" is capitalized.

The strange thing is that I copied the entire procedure to one of my
other mdb files on the same machine and the "r" was automatically
capitalized as "R". So, now I'm wondering if there is something
wrong with mdb file that I'm using. I have already performed a
compact/repair and a decompile/recompile and the problem has not gone
away. I have also verified that the selected references are correct.

Has anyone else had this experience?

When I've seen this, it's been because there is a variable, procedure,
control, field, or other user-defined element in your database that has
the name "right". Try searching fir all occurrences of this text (as a
complete word). I've known this problem to be stubborn, though,
requiring a decompile and recompile even after the offending element was
renamed.
 
M

MikeC

Thank you both. That was it.

I had downloaded a class module from a web site that contained the below
Type statement:

Private Type RECT
Left As Long
top As Long
right As Long
Bottom As Long
End Type

As you can see, the element names coincide with built-in function and
property names, so I'll just rename them. Thanks again for your help.


MikeC said:
Thanks, but that didn't work either. The "R" just reverts back to "r".

Are you saying that this problem is entirely cosmetic and does not
indicate a potentially more serious problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top