List Box Problems - OnClick/AfterUpdate Does Not Change Value

  • Thread starter Thread starter dch3
  • Start date Start date
D

dch3

Here's the deal,

I've buildt my own custom wizard. On one of the pages, I have a list box
that controls the record source for a subform on the page. The idea is that
as the user selects different values in the list box, the subform displays
the relevant values. (i.e. selecting MANAGERS displays the managers). *THIS
PART IS WORKING*

The list box defaults to the first value in the list via a DLookup. The
problem that I have is that sometimes when you click from the Default to a
New Value, the selection changes, but the value of the list box doesn't.
(Confirmed by placing a text box with .ControlSource = lstBox). Typically, if
you click different values once or twice the value will begin to change at
which point the list box functions as expected.

Any ideas? I'm stumpified.
 
What does your code look like? Is this set as a Multi-Select list box? Are
you useing the .Selected property? ... if so you should NOT be (if its
single select).

Also, you may be able to avoid code altogether, if this is a single select
list box, just set the Link Master Field property to the list box control,
then in the Link Child Field property, place the field that is filtered by
your list box. Also, to ensure the first item in the list is chosen upon
form open, set the default property to:

[ListBoxName].[ItemData](0)

Please let me know about the questions I asked, I (or someone else) can use
that info to help you gain a solution.
 
I thought about using the control as the link master field, but I was under
the impression that you could only do that if its a bound control. So an
unbound control can be used?

And no, I'm not using the .Selected property. Also, it is not set as a
multi-select.

Brent Spaulding (datAdrenaline) said:
What does your code look like? Is this set as a Multi-Select list box? Are
you useing the .Selected property? ... if so you should NOT be (if its
single select).

Also, you may be able to avoid code altogether, if this is a single select
list box, just set the Link Master Field property to the list box control,
then in the Link Child Field property, place the field that is filtered by
your list box. Also, to ensure the first item in the list is chosen upon
form open, set the default property to:

[ListBoxName].[ItemData](0)

Please let me know about the questions I asked, I (or someone else) can use
that info to help you gain a solution.

--
Brent Spaulding | datAdrenaline | Access MVP

dch3 said:
Here's the deal,

I've buildt my own custom wizard. On one of the pages, I have a list box
that controls the record source for a subform on the page. The idea is
that
as the user selects different values in the list box, the subform displays
the relevant values. (i.e. selecting MANAGERS displays the managers).
*THIS
PART IS WORKING*

The list box defaults to the first value in the list via a DLookup. The
problem that I have is that sometimes when you click from the Default to a
New Value, the selection changes, but the value of the list box doesn't.
(Confirmed by placing a text box with .ControlSource = lstBox). Typically,
if
you click different values once or twice the value will begin to change at
which point the list box functions as expected.

Any ideas? I'm stumpified.
 
Actually though, the issue isn't the parent/child relationship between the
form/subform. The subform will correctly display the records. The issue is
that when the user clicks on the list box, the selection changes, BUT the
value does not update. This only happens on cetain items in the list box.
After clicking randomly on other selections, the value does change. (I am
confirming the issue with the value by a text box set to =[mylistbox].)

Brent Spaulding (datAdrenaline) said:
What does your code look like? Is this set as a Multi-Select list box? Are
you useing the .Selected property? ... if so you should NOT be (if its
single select).

Also, you may be able to avoid code altogether, if this is a single select
list box, just set the Link Master Field property to the list box control,
then in the Link Child Field property, place the field that is filtered by
your list box. Also, to ensure the first item in the list is chosen upon
form open, set the default property to:

[ListBoxName].[ItemData](0)

Please let me know about the questions I asked, I (or someone else) can use
that info to help you gain a solution.

--
Brent Spaulding | datAdrenaline | Access MVP

dch3 said:
Here's the deal,

I've buildt my own custom wizard. On one of the pages, I have a list box
that controls the record source for a subform on the page. The idea is
that
as the user selects different values in the list box, the subform displays
the relevant values. (i.e. selecting MANAGERS displays the managers).
*THIS
PART IS WORKING*

The list box defaults to the first value in the list via a DLookup. The
problem that I have is that sometimes when you click from the Default to a
New Value, the selection changes, but the value of the list box doesn't.
(Confirmed by placing a text box with .ControlSource = lstBox). Typically,
if
you click different values once or twice the value will begin to change at
which point the list box functions as expected.

Any ideas? I'm stumpified.
 
....hmmm...

I am stumped too ... and with out seeing and playing with the db, I can only
suspect that your form is corrupt. To attempt to fix the form, I would
suggest that you use the undocumented SaveAsText and LoadFromText methods
from the immediate window. Something like this {Note: turn OFF the
NameAutoCorrect options}:

SaveFromText acForm, "A_Form_Name", "C:\Temp\A_Form_Name.frm"

Which saves the form to a text file full of definitions. {You will see that
you can use acForm, acReport, ... etc ...}

Then DELETE (or Rename) ... the form ... then ...

LoadFromText acForm, "A_Form_Name", "C:\Temp\A_Form_Name.frm"

Which rebuilds the form (report/module/macro/etc) based on the definitions
in the text file.


If that does not do the trick, I would suggest you Decompile the application
by starting Access with a command line like:

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" /excl /decompile
"C:\Folder\dbname.mdb"

{note that your path to MSACCESS.EXE may be different}

Once the app opens ... go to the VBA editor and follow the menu path
Debug -> Compile ... Then do a C & R for good measure!



--
Brent Spaulding | datAdrenaline | Access MVP

dch3 said:
Actually though, the issue isn't the parent/child relationship between the
form/subform. The subform will correctly display the records. The issue is
that when the user clicks on the list box, the selection changes, BUT the
value does not update. This only happens on cetain items in the list box.
After clicking randomly on other selections, the value does change. (I am
confirming the issue with the value by a text box set to =[mylistbox].)

Brent Spaulding (datAdrenaline) said:
What does your code look like? Is this set as a Multi-Select list box?
Are
you useing the .Selected property? ... if so you should NOT be (if its
single select).

Also, you may be able to avoid code altogether, if this is a single
select
list box, just set the Link Master Field property to the list box
control,
then in the Link Child Field property, place the field that is filtered
by
your list box. Also, to ensure the first item in the list is chosen upon
form open, set the default property to:

[ListBoxName].[ItemData](0)

Please let me know about the questions I asked, I (or someone else) can
use
that info to help you gain a solution.

--
Brent Spaulding | datAdrenaline | Access MVP

dch3 said:
Here's the deal,

I've buildt my own custom wizard. On one of the pages, I have a list
box
that controls the record source for a subform on the page. The idea is
that
as the user selects different values in the list box, the subform
displays
the relevant values. (i.e. selecting MANAGERS displays the managers).
*THIS
PART IS WORKING*

The list box defaults to the first value in the list via a DLookup. The
problem that I have is that sometimes when you click from the Default
to a
New Value, the selection changes, but the value of the list box
doesn't.
(Confirmed by placing a text box with .ControlSource = lstBox).
Typically,
if
you click different values once or twice the value will begin to change
at
which point the list box functions as expected.

Any ideas? I'm stumpified.
 
I might delete out the offending records from the underlying table to try and
narrow the problem down because it seems to be a certain group. Going from
the first item to the second is fine, but going from the first to the 10th is
a problem

Brent Spaulding (datAdrenaline) said:
....hmmm...

I am stumped too ... and with out seeing and playing with the db, I can only
suspect that your form is corrupt. To attempt to fix the form, I would
suggest that you use the undocumented SaveAsText and LoadFromText methods
from the immediate window. Something like this {Note: turn OFF the
NameAutoCorrect options}:

SaveFromText acForm, "A_Form_Name", "C:\Temp\A_Form_Name.frm"

Which saves the form to a text file full of definitions. {You will see that
you can use acForm, acReport, ... etc ...}

Then DELETE (or Rename) ... the form ... then ...

LoadFromText acForm, "A_Form_Name", "C:\Temp\A_Form_Name.frm"

Which rebuilds the form (report/module/macro/etc) based on the definitions
in the text file.


If that does not do the trick, I would suggest you Decompile the application
by starting Access with a command line like:

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" /excl /decompile
"C:\Folder\dbname.mdb"

{note that your path to MSACCESS.EXE may be different}

Once the app opens ... go to the VBA editor and follow the menu path
Debug -> Compile ... Then do a C & R for good measure!



--
Brent Spaulding | datAdrenaline | Access MVP

dch3 said:
Actually though, the issue isn't the parent/child relationship between the
form/subform. The subform will correctly display the records. The issue is
that when the user clicks on the list box, the selection changes, BUT the
value does not update. This only happens on cetain items in the list box.
After clicking randomly on other selections, the value does change. (I am
confirming the issue with the value by a text box set to =[mylistbox].)

Brent Spaulding (datAdrenaline) said:
What does your code look like? Is this set as a Multi-Select list box?
Are
you useing the .Selected property? ... if so you should NOT be (if its
single select).

Also, you may be able to avoid code altogether, if this is a single
select
list box, just set the Link Master Field property to the list box
control,
then in the Link Child Field property, place the field that is filtered
by
your list box. Also, to ensure the first item in the list is chosen upon
form open, set the default property to:

[ListBoxName].[ItemData](0)

Please let me know about the questions I asked, I (or someone else) can
use
that info to help you gain a solution.

--
Brent Spaulding | datAdrenaline | Access MVP

Here's the deal,

I've buildt my own custom wizard. On one of the pages, I have a list
box
that controls the record source for a subform on the page. The idea is
that
as the user selects different values in the list box, the subform
displays
the relevant values. (i.e. selecting MANAGERS displays the managers).
*THIS
PART IS WORKING*

The list box defaults to the first value in the list via a DLookup. The
problem that I have is that sometimes when you click from the Default
to a
New Value, the selection changes, but the value of the list box
doesn't.
(Confirmed by placing a text box with .ControlSource = lstBox).
Typically,
if
you click different values once or twice the value will begin to change
at
which point the list box functions as expected.

Any ideas? I'm stumpified.
 
Back
Top