|
 |
access thread: enetring subform
Message #1 by "Howard Stone" <ququmber@h...> on Sat, 20 Jul 2002 17:05:13
|
|
I have a form and a subform. The Main form has 4 controls that I validate
to make sure none is left blank before entering the subform.
I have the following procedure attached to the main form
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Validate no blank control
If IsNull(MonthOf) Then
MsgBox("Select a month?)
MonthOf.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(Year) Then
MsgBox("Select a year.")
Year.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(NoOfGuests) Then
MsgBox("Enter the number of forecasted guests.?)
NoOfGuests.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(ForecastDate) Then
MsgBox("Enter a forecast date.?)
ForecastDate.SetFocus
Cancel = True
Exit Sub
End If
Everything works fine but if I click in the subform versus using the Tab
button the MsgBox ?Enter a forecast date? is displayed twice if the only
blank control is Forecast Date. ForecastDate is the last control before
entering the subform.. If I Tab into the subform the message is displayed
only once. If any other control is the last blank control the message is
not displayed twice
How can I stop this duplicate message from being displayed
Thanks
Message #2 by "John Ruff" <papparuff@c...> on Sat, 20 Jul 2002 09:38:38 -0700
|
|
Have you tried to step through your code to determine why the message is
popping up twice.
Place a Stop statement just before the
If IsNull(MonthOf) Then
And then open the form in form view and then open the form in form view
and try to recreate the error. Let us know what you find.
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
www.noclassroom.com
Live software training
Right over the Internet
Home: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Saturday, July 20, 2002 5:05 PM
To: Access
Subject: [access] enetring subform
I have a form and a subform. The Main form has 4 controls that I
validate
to make sure none is left blank before entering the subform.
I have the following procedure attached to the main form
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Validate no blank control
If IsNull(MonthOf) Then
MsgBox("Select a month")
MonthOf.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(Year) Then
MsgBox("Select a year.")
Year.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(NoOfGuests) Then
MsgBox("Enter the number of forecasted guests.")
NoOfGuests.SetFocus
Cancel = True
Exit Sub
ElseIf IsNull(ForecastDate) Then
MsgBox("Enter a forecast date.")
ForecastDate.SetFocus
Cancel = True
Exit Sub
End If
Everything works fine but if I click in the subform versus using the Tab
button the MsgBox "Enter a forecast date" is displayed twice if the
only
blank control is Forecast Date. ForecastDate is the last control before
entering the subform.. If I Tab into the subform the message is
displayed
only once. If any other control is the last blank control the message is
not displayed twice
How can I stop this duplicate message from being displayed
Thanks
Message #3 by "Gregory Serrano" <SerranoG@m...> on Wed, 24 Jul 2002 17:50:55
|
|
Howard,
<< Everything works fine but if I click in the subform versus using the
Tab button the MsgBox ?Enter a forecast date? is displayed twice if the
only blank control is Forecast Date. ForecastDate is the last control
before entering the subform.. If I Tab into the subform the message is
displayed only once. If any other control is the last blank control the
message is not displayed twice >>
Also let us know what code (if any) is attached to the
ForecastDate_AfterUpdate event. If that AfterUpdate event triggers the
the form's BeforeUpdate event, it could explain why that field is making
the message box appear twice.
Greg
|
|
 |