Referencing an Unbound Control on Active Form - Ceased Functioning

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For some reason referencing an unbound control on an active form from a query
has ceased to work correctly. While other previously existing references to
unbound controls in the same form seem to work fine new ones just return null
or if referencing a combo box some random character (usually a box). In fact
any subsequent queries created that reference controls on active forms don't
seem to work properly. What could be causing this problem? Has the database
become corrupted?
 
A point to keep in mind is that you need to leave the control on the form
(tab to another) before its Value gets updated. If you just type into the
control, leave the focus there, and run the query, it will not see the new
value.

You could also test the value of the control by copying the expression from
the query and pasting it into the Immediate Window after a question mark.
Pressing Ctrl+G opens the Immediate window. Then you'll end up with
something like:
? [Forms].[Form1].[Text0]
and when you press Enter it should show you the value.

If that doesn't work, it is possible that the database has a corruption. Try
this sequence (in order):

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
In Access 2007, it's:
Office Button | Access Options | Current Database | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact/Repair
or in Access 2007:
Office Button | Manage | Compact/Repair

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access (holding down the Shift key if you have any startup code),
and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
and the code syntax is compilable.

If it is still a problem, the next step would be to get Access to rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html
 
I get good returns from the immediate window for the unbound controls. Oddly
enough when I reference an simple unbound text box the query works correctly
but when I reference a checkbox, combobox, or frame there are problems. Same
result in different forms and queries in the same database and in new
databases. I suspect the network load for Access has become corrupted.

Allen Browne said:
A point to keep in mind is that you need to leave the control on the form
(tab to another) before its Value gets updated. If you just type into the
control, leave the focus there, and run the query, it will not see the new
value.

You could also test the value of the control by copying the expression from
the query and pasting it into the Immediate Window after a question mark.
Pressing Ctrl+G opens the Immediate window. Then you'll end up with
something like:
? [Forms].[Form1].[Text0]
and when you press Enter it should show you the value.

If that doesn't work, it is possible that the database has a corruption. Try
this sequence (in order):

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
In Access 2007, it's:
Office Button | Access Options | Current Database | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact/Repair
or in Access 2007:
Office Button | Manage | Compact/Repair

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access (holding down the Shift key if you have any startup code),
and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
and the code syntax is compilable.

If it is still a problem, the next step would be to get Access to rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ccsnavy said:
For some reason referencing an unbound control on an active form from a
query
has ceased to work correctly. While other previously existing references
to
unbound controls in the same form seem to work fine new ones just return
null
or if referencing a combo box some random character (usually a box). In
fact
any subsequent queries created that reference controls on active forms
don't
seem to work properly. What could be causing this problem? Has the
database
become corrupted?
 
Back
Top