refreshing a combo box

G

Guest

Hi. I had sent a new post almost an hour ago and it still hasn't shown up so I'm reposting

The question is: How can I get the combo box to show 'blank' just like when the form opens

The background info: I have a form that is based upon a table. The table is a list of names. The combo box is also based upon the same table and displays a list of names. The combo has code to make the form's current record match the selection made in the combo box

The form also has custom record navigation buttons (Previous, Next). Once the user clicks one of these buttons, the form goes to the appropriate record. The "problem" is that the name in the combo box no longer matches the name of the form's current record. Adding the following line of code to the click event of the navigation button does not 'clear out' the combo box. Hence the question above... (Here's the line...

Me.cboSelect.Requer

For clarity, here's the "Next" button's entire code

Private Sub cmdNext_Click(
Me.Recordset.MoveNex
If Me.Recordset.EOF Then Me.Recordset.MoveFirs
Me.cboSelect.Requer
End Su

Any suggestions are appreciated

TI

Rick...
 
S

SFAxess

I would suggest setting the combo box value to Null after
the code moves to the proper record (AfterUpdate event),
or the OnLostFocus event.

i.e.

Sub Form_OnLostFocus()
me.cboYourCombo=Null
End Sub
-----Original Message-----
Hi. I had sent a new post almost an hour ago and it
still hasn't shown up so I'm reposting.
The question is: How can I get the combo box to
show 'blank' just like when the form opens?
The background info: I have a form that is based upon a
table. The table is a list of names. The combo box is
also based upon the same table and displays a list of
names. The combo has code to make the form's current
record match the selection made in the combo box.
The form also has custom record navigation buttons
(Previous, Next). Once the user clicks one of these
buttons, the form goes to the appropriate record.
The "problem" is that the name in the combo box no longer
matches the name of the form's current record. Adding
the following line of code to the click event of the
navigation button does not 'clear out' the combo box.
Hence the question above... (Here's the line...)
 
G

Guest

SFAxess

Thanks for the pointer, the "= Null" works

As an alternative, how would I go about making the combo reflect the form's current record? I tried "Me.cboSelect = me.Bookmark" and I get the blank I was looking for originally. Got a suggestion for this

----- SFAxess wrote: ----

I would suggest setting the combo box value to Null after
the code moves to the proper record (AfterUpdate event),
or the OnLostFocus event

i.e

Sub Form_OnLostFocus(
me.cboYourCombo=Nul
End Su
-----Original Message----
Hi. I had sent a new post almost an hour ago and it
still hasn't shown up so I'm repostingtable. The table is a list of names. The combo box is
also based upon the same table and displays a list of
names. The combo has code to make the form's current
record match the selection made in the combo box(Previous, Next). Once the user clicks one of these
buttons, the form goes to the appropriate record.
The "problem" is that the name in the combo box no longer
matches the name of the form's current record. Adding
the following line of code to the click event of the
navigation button does not 'clear out' the combo box.
Hence the question above... (Here's the line...
 

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