Re: Re-setting combo boxes

Tech-Archive recommends: Fix windows errors by optimizing your registry



Here's the code that runs where I'm having trouble:
(If I put a breakpoint at the "End With" and step
through the code, all the combo boxes "clear".
However, if I let the code run unabated, only
the combo that had the focus "clears", AND not
always that one.)
==============================================
Public Function MajCatSelect(strCategory As String)
Dim strTemp As String

strTemp = "lbl" & strCategory

If strMajCat = strTemp Then Exit Function

With Me
.CmboSubCat1 = Null
.CmboSubCat2 = Null
.CmboSubCat3 = Null
.CmboSubCat4 = Null
End With

Un_Highlight (strMajCat)
LCaseCat (strMajCat)
strMajCat = strTemp
Highlight (strMajCat)
UCaseCat (strMajCat) 'Set major category label to upper case

End Function
==============================================
What's going on here?
Bill

"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7E368897-2066-4BA2-B8C7-16D1795EDD34@xxxxxxxxxxxxxxxx
You will have to explicitly clear all the combos:
With Me
.Combo1 = Null
.Combo2 = Null
End With

--
Dave Hargis, Microsoft Access MVP


"Bill" wrote:

(PS)
I see that whichever of the combo boxes has the
focus that it will clear, but the others won't.
Bill


"Bill" <stanton@xxxxxxx> wrote in message
news:F0Uyh.22416$yx6.19763@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have several combo boxes that have values
selected under certain conditions. When the
user makes a certain change in those conditions,
most all of the combo boxes need to revert to
the same state they're in when the form opens,
namely blank. In the event code that gets
control with such a change, I have the following
form of code: (several such)

cmboMyCombo = Null

Sometimes the boxes clear and sometimes they
don't. What do I need to do to insure that they
always clear? I suppose if I Requery each one
that would do the trick, but intuitively that seems
excessive.

Bill






.



Relevant Pages

  • Re: Re-setting combo boxes
    ... the combo boxes clear as intended. ... "Bill" wrote: ... If strMajCat = strTemp Then Exit Function ... .CmboSubCat1 = Null ...
    (microsoft.public.access.formscoding)
  • Re: Re-setting combo boxes
    ... "Bill" wrote: ... If strMajCat = strTemp Then Exit Function ... .CmboSubCat1 = Null ... I see that whichever of the combo boxes has the ...
    (microsoft.public.access.formscoding)
  • Re: Re-setting combo boxes
    ... "Bill" wrote: ... If strMajCat = strTemp Then Exit Function ... .CmboSubCat1 = Null ... I see that whichever of the combo boxes has the ...
    (microsoft.public.access.formscoding)
  • Re: Re-setting combo boxes
    ... "Bill" wrote: ... If strMajCat = strTemp Then Exit Function ... .CmboSubCat1 = Null ... I see that whichever of the combo boxes has the ...
    (microsoft.public.access.formscoding)
  • Re: Re-setting combo boxes
    ... "Bill" wrote: ... If strMajCat = strTemp Then Exit Function ... .CmboSubCat1 = Null ... I see that whichever of the combo boxes has the ...
    (microsoft.public.access.formscoding)