Resetting ComboBox on Form

  • Thread starter nclsgna via AccessMonster.com
  • Start date
N

nclsgna via AccessMonster.com

I have a form with two combo boxes ([NmF] and [NmL]) and a calculated text
box ([NmFL]) that is a concatenated value of [NmL] & [NmF]. [NmL] is limited
to a query with [NmF] value as criteria.

I have a command box to reset the values in [NmF] and [NmL] if the user
decides to change the two. Code to reset is:

Private Sub Command24_Click()
NmF.Value = Null
NmL.Value = Null
End Sub

Complication:
If I run Command24_Click(), the [NmL] box retains the last value list from
the previously entered [NmF] value.

Is there a way of making the box requery after resetting so that i get
current values?
 
M

Marshall Barton

nclsgna said:
I have a form with two combo boxes ([NmF] and [NmL]) and a calculated text
box ([NmFL]) that is a concatenated value of [NmL] & [NmF]. [NmL] is limited
to a query with [NmF] value as criteria.

I have a command box to reset the values in [NmF] and [NmL] if the user
decides to change the two. Code to reset is:

Private Sub Command24_Click()
NmF.Value = Null
NmL.Value = Null
End Sub

Complication:
If I run Command24_Click(), the [NmL] box retains the last value list from
the previously entered [NmF] value.

Is there a way of making the box requery after resetting so that i get
current values?


The NmF combo box's AfterUpdate event need to Requery the
NmL combo box:
Me.NmL.Requery
You will want to use the same line of code in the form's
Current event and in your button's Click event.
 
N

nclsgna via AccessMonster.com

Thanks guys, I have done as you suggested and its working perfectly.

Marshall said:
I have a form with two combo boxes ([NmF] and [NmL]) and a calculated text
box ([NmFL]) that is a concatenated value of [NmL] & [NmF]. [NmL] is limited
[quoted text clipped - 14 lines]
Is there a way of making the box requery after resetting so that i get
current values?

The NmF combo box's AfterUpdate event need to Requery the
NmL combo box:
Me.NmL.Requery
You will want to use the same line of code in the form's
Current event and in your button's Click event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top