Bob Howard said:
I'm trying to use Stephen Lebans' "Justify" module in an A2K3 program
running under A2K7 Runtime under Vista. The program has been working fine
for a couple of years when simply running under A2K3 ... but now I'm just
trying to get it working under A2K7 Runtime and am having a problem.
I'm right-justifying a column in a listbox that's in a subform.
It all works OK for a while, but I get several A2K7 error messages when my
VBA code issues a requery for the listbox's controlsource (which points to
a query containing the function call to the Lebans code).
Anyone having issues with this code??
bob
I found the problem and implemented a work-around ... not the best, but it's
at least working.
The error I was getting was "You entered an expression that has an invalid
reference to the property Form/Report"
The "justified" column in the listbox (unbound --- used for reference and
navigation purposes only) appeared properly on the screen ... the problem
only occurs when I requery the listbox while in dataentry mode and while
pointing to the "empty" record that you get when in that mode (before
anything is moved to any of that records fields so it's perhaps only a
placeholder).
Here's the situation:
The problems were caused by a difference in how Access 2007 handles bound
forms that have their DataEntry property set to "True".
After my user enters some data, they click a button which takes them to a
"Save" routine (VBA). In that routine, I issue a command to move to the
"empty" record ... thus saving the record just entered. I then need to get
things ready for the user to enter the next record.
I have an unbound listbox control on the form, and the query behind the
rowsource is what contains the "justify" stuff. As part of my getting ready
for the next record, I need to requery that listbox. Of course, the
"justify" info, which is in one of the columns of that query, also refers to
that listbox.
Here's where the Access 2007 difference comes into play. When the
recordsource is pointing to the "empty" record, it appears that controls on
this form (* see below --- this is actually a sub-form) cannot be
referenced! My only recourse is to set dataentry to false for a moment,
requery the listbox, and then set dataentry back to true again. It's a bit
deeper than this, but wrapping my setup routine with code to exit dataentry
mode PLUS temporarily disabling my error handler (i.e., Resume Next for a
few lines of code) did the trick.
The overall form is actually a main form that's not in dataentry mode, a
subform that is in dataentry mode, and that subform has a subform. The
"Save" button is in the middle one (the subform below the main form) and the
listbox is in the bottom one (the subform of the subform). That bottom one
is not a dataentry form ... just the one in the middle.
The prior code worked fine when this was an Access 2000 database / program,
and continued to work fine when I converted everything to Access 2003. But
running the Access 2003 program under Access 2007 runtime made this error
come to the surface.
So I've gotten around it ... although I'm not particularly fond of it...
bob