Notify user to refresh form

G

Guest

Hi - Am using Access ('02) to input a photo archive from a truck body
manufacturer. Have set up the following fields:
Reason (why photo was taken). Most pics are "Portraits", in which case we
list a:
BodyStyle (tank, delivery, milk, fire pumper, beer, tow, etc.)
Other reasons are Insurance, plant views, and truck show pics. (No BodyStyle)

I have figured out how to disable the bodystyle combo box in my form using:
Private Sub cboReason_AfterUpdate()
If Not 1 Then Me.cboBodyStyle.Enabled = False
End Sub
where 1 = portrait, AND
Private Sub Form_AfterUpdate()
Me.cboBodyStyle.Enabled = True
End Sub
to re-set the control when moving to the next entry. My first efforts at
code from scratch and these actually work - what a thrill! Also FYI - the
default for reason is portrait.

If a user changes the reason accidentally, then changes back to portrait,
the bodystyle box is still disabled. Not so good. So I added:

Private Sub txtSubjComment_GotFocus()
Dim Msg, Style
'Define message
Msg = "If you need to change the body style, hit F9"
'define style
Style = vbOKOnly
'Display message
Response = MsgBox(Msg, Style)
End Sub
SubjComment is the next field after Reason & BodyStyle.
(Even this works!) It does what I tell it, but all the time, which is very
annoying. Obviously I'm working with the wrong event, or else I need to add
another condition? Should it be something like
if cboReason_AfterUpdate = 1 then Response = MsgBox
Just tried it and that didn't work.

Should I be changing the event or adding qualifiers to
txtSubjComment_GotFocus or both??

Thanks very much
 
G

Guest

Two more thoughts

Is
Private Sub Form_AfterUpdate()
Me.cboBodyStyle.Enabled = True
End Sub
the right event to re-enable the bodystyle box?

Guess my conditions should be
If Reason=Portrait and BodyStyle.Enabled = false
then make the message box appear (?)

Thanks again - Lisa
 

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