Solved Why .Value changes to .value (1 Viewer)

Sun_Force

Active member
Local time
Today, 16:14
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:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:14
Joined
May 7, 2009
Messages
19,246
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:14
Joined
Oct 29, 2018
Messages
21,501
You could also try decompiling your project. Just a thought...
 

Sun_Force

Active member
Local time
Today, 16:14
Joined
Aug 29, 2020
Messages
396
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:14
Joined
May 7, 2009
Messages
19,246
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".
 

DaveT2001

New member
Local time
Today, 02:14
Joined
Jun 15, 2021
Messages
5
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.
 

Sun_Force

Active member
Local time
Today, 16:14
Joined
Aug 29, 2020
Messages
396
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.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 02:14
Joined
Feb 28, 2001
Messages
27,245
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.
 

oleronesoftwares

Passionate Learner
Local time
Today, 00:14
Joined
Sep 22, 2014
Messages
1,159
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.
 

Minty

AWF VIP
Local time
Today, 08:14
Joined
Jul 26, 2013
Messages
10,371
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!
 

Sun_Force

Active member
Local time
Today, 16:14
Joined
Aug 29, 2020
Messages
396
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.
 

GPGeorge

George Hepworth
Local time
Today, 00:14
Joined
Nov 25, 2004
Messages
1,929
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.
 

Minty

AWF VIP
Local time
Today, 08:14
Joined
Jul 26, 2013
Messages
10,371
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.
 

isladogs

MVP / VIP
Local time
Today, 08:14
Joined
Jan 14, 2017
Messages
18,247
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:14
Joined
Feb 19, 2002
Messages
43,374
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.
 

Sun_Force

Active member
Local time
Today, 16:14
Joined
Aug 29, 2020
Messages
396
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

Top Bottom