Solved Why .Value changes to .value

Sun_Force

Active member
Local time
Tomorrow, 02:24
Joined
Aug 29, 2020
Messages
396
In one of my databases .Value changes to .value as soon as I exit the line.
I searched the whole project to see if a variable named value is declared anywhere. I couldn't find any.
In a copy of database, I started deleting one object at a time (form-report-module) to find out the source of this problem.

Now the whole database contains only one module and only one sub. All forms-reports-modules-macors-tables-queries are deleted.
but still the problem persists.
Code:
Sub test()
    Dim obj As Access.TextBox
    Debug.Print obj.value
End Sub

this is the only procedure in the database. No matter how many times I type .Value, it changes to .value
I've compiled & repaired, decompiled and re-compiled.

Anywhere else I have to check?
Any kind of advice is much appreciated.
 
Last edited:
sometimes that happens, when you use "small" letters instead of the Proper case
of the member. MSA somehow remembers.

i would be surprise if it still occurs if you Create new db and create same sub
and still it persist to replace .Value with .value, then something is really wrong.
 
You could also try decompiling your project. Just a thought...
 
sometimes that happens, when you use "small" letters instead of the Proper case
of the member. MSA somehow remembers.

i would be surprise if it still occurs if you Create new db and create same sub
and still it persist to replace .Value with .value, then something is really wrong.

New or other existing databases are OK. This is specific to this database.
 
i wouldn't worry much, if the property still show it's intent and purpose.
.value still returns the "value" rather than the "forecolor" or "backcolor".
 
In one of my databases .Value changes to .value as soon as I exit the line.
I searched the whole project to see if a variable named value is declared anywhere. I couldn't find any.
In a copy of database, I started deleting one object at a time (form-report-module) to find out the source of this problem.

Now the whole database contains only one module and only one sub. All forms-reports-modules-macors-tables-queries are deleted.
but still the problem persists.
Code:
Sub test()
    Dim obj As Access.TextBox
    Debug.Print obj.value
End Sub

this is the only procedure in the database. No matter how many times I type .Value, it changes to .value
I've compiled & repaired, decompiled and re-compiled.

Anywhere else I have to check?
Any kind of advice is much appreciated.
It's been a while, but I've seen this behavior before. In my case I think it was dao. v DAO.
You might try Edit, Replace, Current Project using the proper case in the Replace With field.

CAUTION: A global find/replace can make unwanted changes. It's important that the Find and Replace fields be exact.
One way to check ahead of time, is to use Edit, Find first, keep clicking on Find Next until you've stepped through the entire project and only found cases you want fixed.
 
It's been a while, but I've seen this behavior before. In my case I think it was dao. v DAO.
You might try Edit, Replace, Current Project using the proper case in the Replace With field.

CAUTION: A global find/replace can make unwanted changes. It's important that the Find and Replace fields be exact.
One way to check ahead of time, is to use Edit, Find first, keep clicking on Find Next until you've stepped through the entire project and only found cases you want fixed.

As I explained, now the database has only one procedure and only two lines. No form, no report not anything else.
Still when I correct it to .Value, it changes to .value again.

thanks for trying to help.
 
Actually, I would wonder if the object has become de-referenced when you lose the capital V for .Value, because it would mean that Access cannot use Intellisense at that time.
 
You can try creating a new database, then importing all objects into it,but since it doesn't occur in a new database, my guess is that VBA encountered an error at a time you were working on the database, its been a while such occurred on my system(Ms access/VBA), but i have seen it recently while working in Visual studio, the code intellisence just stop working, until i close and re start the IDE.
 
In a module at the top do the following

Dim Value as Variant

Save the module compact and repair
Delete the variable - normal order should have been restored!
 
In a module at the top do the following

Dim Value as Variant

Save the module compact and repair
Delete the variable - normal order should have been restored!
You are a star. I really don't know how to thank you.
Have a happy holidays.
 
I know you have a solution, but here's another tip I picked up a while back.
VBA is not case sensitive. It is possible that when you change the lower case v to and upper case V, Access doesn't really see that as a change.

The tip was to change .value to something like .valuex and save the module. Yes, it won't compile. Close and open it and correct the spelling to .Value again. That has worked for me in the past, although it's not 100% consistent.
 
I think something in the background of the Access program gets confused.
The declaration forces the cached lowercase value (oh oh almost a pun :rolleyes: ) back to the correct case and it fixes itself.
 
I had the same issue with Right being changed to right some time ago. I tried everything suggested above and eventually gave up and reinstalled Office. The issue continued even after that. Some months later it fixed itself....no idea why...

Similarly whenever I type certain words like First in this forum, the site software always capitalises them. No idea why nor how to fix it
 
As I explained, now the database has only one procedure and only two lines. No form, no report not anything else.
Still when I correct it to .Value, it changes to .value again.
Add back the form. Put the code into the form's class module. Then .Value will be capitalized You have dim'd the object as a textbox but you have not set it to anything. You can't just create form countrols that exist in thin air.
 
You have dim'd the object as a textbox but you have not set it to anything.
When I typed obj. Intellisense shows all properties and methods of a textbox.
When I selected Value from the list, still it changed to value. So I think when I dim an object as a textbox, Access behaves as it's actually set as a textbox.

Now the problem is solved. Next time I face the same problem, I will try your suggestion to see if it makes any difference.
Thanks for the advice.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom