Trim() not trim(); SetFocus() not setFocus()

G

Guest

Hello,

I have been noticing that when I write a line such as 'Me.Trim()', the
editer converts the 'Trim()' function to lowercase when I move to another
line. For 'Me.SetFocus()', it converts 'SetFocus()' to 'setFocus()'. However,
the 'Me' keyword is converted correctly if I use all lowercase in both cases.
I checked the object browser and everything seems okay there and the code
works fine. I am using Access 2003 and Windows XP Pro SP2 on a corporate
network. I've tried this at home with Windows XP SP2 and Access 2002 and it
works fine there.

Any help would be appreciated.

Regards,

Paul
 
D

Dirk Goldgar

In
Paul said:
I have been noticing that when I write a line such as 'Me.Trim()', the
editer converts the 'Trim()' function to lowercase when I move to
another line. For 'Me.SetFocus()', it converts 'SetFocus()' to
'setFocus()'. However, the 'Me' keyword is converted correctly if I
use all lowercase in both cases. I checked the object browser and
everything seems okay there and the code works fine. I am using
Access 2003 and Windows XP Pro SP2 on a corporate network. I've tried
this at home with Windows XP SP2 and Access 2002 and it works fine
there.

Usually that means you have defined some other function, variable, or
object with the differently capitalized version of the same name. Or
possibly they are defined in another library to which you have a
reference.

Conduct a thorough search for the offending object(s). If you can't
find them, it could be a residual autocorrection from some such object
that you used to have, but have since deleted. You may be able to get
it to go away by doing the following:

(a) Define your own global variables or procedures with the correctly
captialized names. Check whether all the mis-capitalized versions have
been corrected. If they haven't, do a global find and replace. Then
recompile your application, and see if things stay capitalized the way
they should. Then delete the global variables or procedures that you
created, recompile, and see if all is well now.

(b) If that doesn't work, try importing everything into a new database.
Do a global find and replace to fix the bad capitalizations, then
compile and see if all is well.

(c) If that doesn't work, try decompiling a copy of your database, then
doing a global find and replace, then recompile. Instructions for
decompiling follow my sig.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

HOW TO DECOMPILE AN ACCESS DATABASE

1. With the database closed -- no users in it at all -- and (ideally)
Access not running, make a backup copy.

2. On the task bar, click Start -> Run...

3. Enter this (adapted to match your database path and name) in the Run
dialog box and click OK:

msaccess.exe /decompile "C:\My Documents\YourDBName.mdb"

You may need to include the full path to msaccess.exe, but I don't find
that to be the case when I try it. Depending on your Access version,
you may not get any sign that anything in particular happened. Your
database will probably open in Access.

4. Compact and Repair your database.

5. Open the database again, press Alt+F11 to switch to the VB Editor,
and click Debug -> Compile (your project). If any errors appear, fix
them and recompile.

6. Close the VB Editor. Compact & Repair again.

See if the problem has disappeared.
 
A

AnandaSim

Hello,

I have been noticing that when I write a line such as 'Me.Trim()', the
editer converts the 'Trim()' function to lowercase when I move to another
line. For 'Me.SetFocus()', it converts 'SetFocus()' to 'setFocus()'. However,
the 'Me' keyword is converted correctly if I use all lowercase in both cases.

Are we on the same page?

Me is the Form instance.

Trim() is a VBA function to trim strings and is usually

strThis = trim(strFullname)

Me.Trim()

is not valid in Access VBA?

Me.SetFocus

is valid Access VBA - it means to make the Form active.
There is no SetFocus() in Access VBA - there might be in VB.NET which
is more OOP.

HTH

Ananda
 
L

Linq Adams via AccessMonster.com

I'm npt sure we're even in the same library, much less the same page! My
guess would be that Access is completely flummoxed for the reasons that
Ananda has pointed out!

Trim() is a function; Me.Trim() is treating it like a property of the form.

SetFocus is a property, but Me.SetFocus() is treating it like a function.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

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