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 when
reason is not portrait using:
Private Sub cboReason_AfterUpdate()
If Not 1 Then Me.cboBodyStyle.Enabled = False
End Sub
(1 = portrait, which is default), AND
Private Sub Form_AfterUpdate()
Me.cboBodyStyle.Enabled = True
End Sub
to re-set the control when moving to the next entry. Is this the right event
to re-enable the bodystyle box? (My first efforts at code from scratch and
these actually work - what a thrill!)
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?? Or doing something completely different?
If going the message box route, I guess my conditions / the logic should be:
If Reason=Portrait and BodyStyle.Enabled = false
then make the message box appear (?) How?
I wanted to do this with a Macro but couldn't figure out what action would
disable the combo box.
Thanks very much - Lisa
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 when
reason is not portrait using:
Private Sub cboReason_AfterUpdate()
If Not 1 Then Me.cboBodyStyle.Enabled = False
End Sub
(1 = portrait, which is default), AND
Private Sub Form_AfterUpdate()
Me.cboBodyStyle.Enabled = True
End Sub
to re-set the control when moving to the next entry. Is this the right event
to re-enable the bodystyle box? (My first efforts at code from scratch and
these actually work - what a thrill!)
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?? Or doing something completely different?
If going the message box route, I guess my conditions / the logic should be:
If Reason=Portrait and BodyStyle.Enabled = false
then make the message box appear (?) How?
I wanted to do this with a Macro but couldn't figure out what action would
disable the combo box.
Thanks very much - Lisa