Autocomplete problem

A

Adam

Ill try to set up my situation as easily as possible.

I have a bunch of combo boxes, and each combo gets filtered by the one prior
to it. If there is only one option in the combo due to the filtering, it
auto-fills in the combo box when you select the combo box; something like
this for all the combo boxes:

Private Sub Well_Desig_GotFocus()
If Me.Well_Desig.ListCount = 1 Then
Me.Well_Desig = Me.Well_Desig.ItemData(0)
End If
End Sub

Also, each combo box is set to requery all the combo boxes after itself when
something is chosen:

Private Sub Well_Desig_AfterUpdate()
Me.Depth = ""
Me.Depth.Requery
Me.Requery

Me.Avg_HD = ""
Me.Avg_HD.Requery
Me.Requery

Me.Avg_HD_HUR_LN = ""
Me.Avg_HD_HUR_LN.Requery
Me.Requery

Me.Date_Revised = ""
Me.Date_Revised.Requery
Me.Requery
End Sub


The form works great when it is first opened, but after going through all 13
boxes and then wanting to start over at combo1 (i click a command button made
that requerys the whole form, so all combos go blank again and i can begin
with combo1), the autocomplete will not work, you have to use the drop downs
and actually click on the value even though there is only one value in the
list. Sorry for the long drawn out situation, just hoping to make everything
as clear as possible on the first post.

Any suggestions how to correct this?
 
R

Ryan

Instead of your command button requering the form, why not have it close and
reopen the form. Your command button would look like this.

Private Sub Refresh_Click()
DoCmd.Close
DoCmd.OpenForm "YourFormName",,,,acFormAdd
End Sub

This would give you a fresh start every time.
 
A

Adam

Good call, that works. Thanks!

Ryan said:
Instead of your command button requering the form, why not have it close and
reopen the form. Your command button would look like this.

Private Sub Refresh_Click()
DoCmd.Close
DoCmd.OpenForm "YourFormName",,,,acFormAdd
End Sub

This would give you a fresh start every time.
 

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