form flicker

G

Guest

Hello All,

I have designed a database with several forms that hide or show certain
controls (text and combo boxes) as needed. These forms have a background
image that is effectively white (there is some decoration around the border).
In my form's OnCurrent event, I set each controls visibility as appropriate.
However, even if a control is supposed to remain hiddedn between two records,
a grey box appears and then disappears where the control is supposed to be.
I've tried setting each control's visible property to False by default,
andthis still makes no difference. Similarly, I've set white backgrounds and
invisible borders, with the same result. Any ideas how to make my forms not
have this flicker? Granted, it's not functionally necessary, but it would
sure look a lot better... Thanks,

Matt
 
D

Dirk Goldgar

MartinMCU said:
Hello All,

I have designed a database with several forms that hide or show
certain controls (text and combo boxes) as needed. These forms have a
background image that is effectively white (there is some decoration
around the border). In my form's OnCurrent event, I set each controls
visibility as appropriate. However, even if a control is supposed to
remain hiddedn between two records, a grey box appears and then
disappears where the control is supposed to be. I've tried setting
each control's visible property to False by default, andthis still
makes no difference. Similarly, I've set white backgrounds and
invisible borders, with the same result. Any ideas how to make my
forms not have this flicker? Granted, it's not functionally
necessary, but it would sure look a lot better... Thanks,

Matt

Please post the code from your form's Current event. Also, do you have
conditional formatting operating on this form?
 
G

Guest

Dirk,

Not quite sure what you mean by conditional formatting. Before I post my
code, allow me to elaborate more fully on the form's design. This form is the
main data entry form for an inventory database of electronic components.
There is a combo box, cboCategory from which the user can select a catagory
to classify the part (ie, "Resistor", "Capacitor", etc). Each category has
several category specific detail fields associated with it. These fields are
either free valued or lookup based. The free valued fields are stored in
tboDetailA, tboDetailB, ..., tboDetailF (where tbo denotes a textbox). The
lookup based values are stored in cboDetail1, ..., cboDetail6). Thus, a
resistor might have a tboDetailA value of "100", and a cboDetail1 value of
"Ohms". The reason for having both free and lookup values is to keep data
consistent between all the parts (ie, a resistor can be any numeric value,
but only "Ohms", "kOhms", or "MOhms"). Since any given category of part will
probably not have all twelve possible detail fields used, the unused fields
are hidden to prevent extraneous and erroneous data from being entered. The
visibilities are set based on twelve text box fields, tboDetailName1, ...,
tboDetailName6, tboDetailNameA, ..., tboDetailNameF. These fields are
populated by the query which drives the form. I have two tables, the
inventory (tblInventory) and a category definition table
(tblCategorySpecificDetailNames) which are joined on a category field. Thus,
changing the category of an item in tblInventory pulls in the correct values
from tblCategorySpecificDetailNames. Now, if one of the tboDetailName fields
is empty (null), it means that that detail is not used by the particular
category, and the corresponding tboDetail or cboDetail field is hidden. And
with that, hopefully the following code is clear. One other thing to note, is
that in addition to the tboDetailName and t/cboDetail fields flickering on
changing the record, a few other controls flicker as well, most notable the
text box tboPartName, which should always be visible. Thanks,

Matt Martin

Private Sub Form_Current()

setVisibilities

' Requery the combo boxes to place the appropriate values for the new
category in
cboDetail1.Requery
cboDetail2.Requery
cboDetail3.Requery
cboDetail4.Requery
cboDetail5.Requery
cboDetail6.Requery
cboPackageStyle.Requery

End Sub


Private Sub setVisibilities()
' Hide detail fields that are not used by the current category

If IsNull(tboDetailName1) Then
cboDetail1.Visible = False
Else
cboDetail1.Visible = True
End If

If IsNull(tboDetailName2) Then
cboDetail2.Visible = False
Else
cboDetail2.Visible = True
End If

If IsNull(tboDetailName3) Then
cboDetail3.Visible = False
Else
cboDetail3.Visible = True
End If

If IsNull(tboDetailName4) Then
cboDetail4.Visible = False
Else
cboDetail4.Visible = True
End If

If IsNull(tboDetailName5) Then
cboDetail5.Visible = False
Else
cboDetail5.Visible = True
End If

If IsNull(tboDetailName6) Then
cboDetail6.Visible = False
Else
cboDetail6.Visible = True
End If

If IsNull(tboDetailNameA) Then
tboDetailA.Visible = False
Else
tboDetailA.Visible = True
End If

If IsNull(tboDetailNameA) Then
tboDetailA.Visible = False
Else
tboDetailA.Visible = True
End If

If IsNull(tboDetailNameB) Then
tboDetailB.Visible = False
Else
tboDetailB.Visible = True
End If

If IsNull(tboDetailNameC) Then
tboDetailC.Visible = False
Else
tboDetailC.Visible = True
End If

If IsNull(tboDetailNameD) Then
tboDetailD.Visible = False
Else
tboDetailD.Visible = True
End If

If IsNull(tboDetailNameE) Then
tboDetailE.Visible = False
Else
tboDetailE.Visible = True
End If

If IsNull(tboDetailNameF) Then
tboDetailF.Visible = False
Else
tboDetailF.Visible = True
End If

End Sub
 
D

Dirk Goldgar

MartinMCU said:
Dirk,

Not quite sure what you mean by conditional formatting.

Conditional formatting is the feature (first available in Access 2000)
to let Access automatically modify certain format propoerties of
controls based on values or expressions. If you don't know what it is,
I guess you're not using it.
Before I post
my code, allow me to elaborate more fully on the form's design.

Thanks. I've snipped your description from my response in the interest
of brevity.
Private Sub Form_Current()

setVisibilities

' Requery the combo boxes to place the appropriate values for the
new category in
cboDetail1.Requery
cboDetail2.Requery
cboDetail3.Requery
cboDetail4.Requery
cboDetail5.Requery
cboDetail6.Requery
cboPackageStyle.Requery

End Sub


Private Sub setVisibilities()
' Hide detail fields that are not used by the current category

If IsNull(tboDetailName1) Then
cboDetail1.Visible = False
Else
cboDetail1.Visible = True
End If

If IsNull(tboDetailName2) Then
cboDetail2.Visible = False
Else
cboDetail2.Visible = True
End If

If IsNull(tboDetailName3) Then
cboDetail3.Visible = False
Else
cboDetail3.Visible = True
End If

If IsNull(tboDetailName4) Then
cboDetail4.Visible = False
Else
cboDetail4.Visible = True
End If

If IsNull(tboDetailName5) Then
cboDetail5.Visible = False
Else
cboDetail5.Visible = True
End If

If IsNull(tboDetailName6) Then
cboDetail6.Visible = False
Else
cboDetail6.Visible = True
End If

If IsNull(tboDetailNameA) Then
tboDetailA.Visible = False
Else
tboDetailA.Visible = True
End If

If IsNull(tboDetailNameA) Then
tboDetailA.Visible = False
Else
tboDetailA.Visible = True
End If

If IsNull(tboDetailNameB) Then
tboDetailB.Visible = False
Else
tboDetailB.Visible = True
End If

If IsNull(tboDetailNameC) Then
tboDetailC.Visible = False
Else
tboDetailC.Visible = True
End If

If IsNull(tboDetailNameD) Then
tboDetailD.Visible = False
Else
tboDetailD.Visible = True
End If

If IsNull(tboDetailNameE) Then
tboDetailE.Visible = False
Else
tboDetailE.Visible = True
End If

If IsNull(tboDetailNameF) Then
tboDetailF.Visible = False
Else
tboDetailF.Visible = True
End If

End Sub

I don't see why the showing/hiding you're doing should make the form
flicker, but it occurs to me that maybe the requerying of all the combos
is delaying the repainting of the form somehow. Try adding these lines
before the end of your setVisibilities procedure:

Me.Repaint
DoEvents

If the two together make the problem go away, try commenting out each of
the two lines in turn, to see if maybe you only need one of them. If
they don't help at all, let me know that, too.
 
G

Guest

Dirk,

Unfortunately, adding those two lines didn't sem to have any effect. In
addition to all the detail and name fields flickering (ie, displaying blank
grey before being properly shown or hidden), the text box for part name
flickers, the combo box for package style flickers (which does get
requeried), and a check box denoting exact count flickers. The text box and
check box are simply populated as part of the record, so they are quite
puzzling as to why they would flicker, as they are not in any way referenced
by setVisibilities(). Any other thoughts? Thanks,

Matt
 
G

Guest

I also tried rewriting setVisibilities() as given below, to no effect. But I
think I shall keep it regardless, as it looks much cleaner:

Private Sub setVisibilities()
' Hide detail fields that are not used by the current category

cboDetail1.Visible = Not IsNull(tboDetailName1)
cboDetail2.Visible = Not IsNull(tboDetailName2)
cboDetail3.Visible = Not IsNull(tboDetailName3)
cboDetail4.Visible = Not IsNull(tboDetailName4)
cboDetail5.Visible = Not IsNull(tboDetailName5)
cboDetail6.Visible = Not IsNull(tboDetailName6)
tboDetailA.Visible = Not IsNull(tboDetailNameA)
tboDetailB.Visible = Not IsNull(tboDetailNameB)
tboDetailC.Visible = Not IsNull(tboDetailNameC)
tboDetailD.Visible = Not IsNull(tboDetailNameD)
tboDetailE.Visible = Not IsNull(tboDetailNameE)
tboDetailF.Visible = Not IsNull(tboDetailNameF)

Me.Repaint
DoEvents

End Sub
 
D

Dirk Goldgar

MartinMCU said:
Dirk,

Unfortunately, adding those two lines didn't sem to have any effect.
In addition to all the detail and name fields flickering (ie,
displaying blank grey before being properly shown or hidden), the
text box for part name flickers, the combo box for package style
flickers (which does get requeried), and a check box denoting exact
count flickers. The text box and check box are simply populated as
part of the record, so they are quite puzzling as to why they would
flicker, as they are not in any way referenced by setVisibilities().
Any other thoughts? Thanks,

Matt

If you take out the call to setVisibilities altogether, does the
flickering disappear?

I'm running out of guesses. If you'd like to send me a cut-down copy of
your database, containing only the elements necessary to demonstrate the
problem, compacted and then zipped to less than 1MB in size (preferably
much smaller) -- I'll have a look at it, time permitting. You can send
it to the address derived by removing NO SPAM from the reply address of
this message. If that address isn't visible to you, you can get it from
my web site, which is listed in my sig. Do *not* post my real address
in the newsgroup -- I don't want to be buried in spam and viruses.
 
D

Dirk Goldgar

MartinMCU said:
I also tried rewriting setVisibilities() as given below, to no
effect. But I think I shall keep it regardless, as it looks much
cleaner:

Private Sub setVisibilities()
' Hide detail fields that are not used by the current category

cboDetail1.Visible = Not IsNull(tboDetailName1)
cboDetail2.Visible = Not IsNull(tboDetailName2)
cboDetail3.Visible = Not IsNull(tboDetailName3)
cboDetail4.Visible = Not IsNull(tboDetailName4)
cboDetail5.Visible = Not IsNull(tboDetailName5)
cboDetail6.Visible = Not IsNull(tboDetailName6)
tboDetailA.Visible = Not IsNull(tboDetailNameA)
tboDetailB.Visible = Not IsNull(tboDetailNameB)
tboDetailC.Visible = Not IsNull(tboDetailNameC)
tboDetailD.Visible = Not IsNull(tboDetailNameD)
tboDetailE.Visible = Not IsNull(tboDetailNameE)
tboDetailF.Visible = Not IsNull(tboDetailNameF)

Me.Repaint
DoEvents

End Sub

I agree: that's a lot tidier.
 

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