Deb.. did you get a solution for this? I'm going nuts with the same problem. I saw answers to your post but they didn't help me.
Thx, Dave
deb wrote:
continuous subform validation
10-Nov-09
On Access 2003
I have a main form called f040ProjectMain(PK ProjectID)
I have some fields on the main form that are needed to be populated so I
have the below code..
If IsNull(Me!Scope) Or IsNull(Me!ProjStatusID) Or IsNull(Me!ProjCategory) Or
IsNull(Me!PMID) Then
MsgBox "You must complete all required(*) fields before selecting other
fields."
Cancel = True
Me!ProjectName.SetFocus
End If
I also have a CONTINUOUS subform called fMilestones. I need to make sure
the user enters a milestone for KeyMilestoneSubID 12 and 20. How can I add
this requirement to the aboce code to make sure user enters a milestone for
BOTH 12 and 20?
--
deb
Previous Posts In This Thread:
continuous subform validation
On Access 2003
I have a main form called f040ProjectMain(PK ProjectID)
I have some fields on the main form that are needed to be populated so I
have the below code..
If IsNull(Me!Scope) Or IsNull(Me!ProjStatusID) Or IsNull(Me!ProjCategory) Or
IsNull(Me!PMID) Then
MsgBox "You must complete all required(*) fields before selecting other
fields."
Cancel = True
Me!ProjectName.SetFocus
End If
I also have a CONTINUOUS subform called fMilestones. I need to make sure
the user enters a milestone for KeyMilestoneSubID 12 and 20. How can I add
this requirement to the aboce code to make sure user enters a milestone for
BOTH 12 and 20?
--
deb
Hi deb,not in the main form's code, but in the Before Update event on
Hi deb,
not in the main form's code, but in the Before Update event on the
continuous subform, put code something like this untested air code.
If Me.[KeyMilestoneSubID] = 12 or KeyMilestoneSubID = 20 Then
If IsNull(Me.NameOfMilestoneField) Then
Cancel = True
Msgbox "Milestone required"
End If
End If
Replace NameOfMilestoneField with the appropriate control/field name.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Either In the Before or After Update event of the subform, add the
Either In the Before or After Update event of the subform, add the validation
code.
I prefer to do it in the AfterUpdate.
:
Not sure how that would work if you use the after update event - there is
Not sure how that would work if you use the after update event - there is no
cancel parameter with the after update event.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
I know I need the validation code but I am not sure how to write it toinclude
I know I need the validation code but I am not sure how to write it to
include the fields in the continuous subform.
How do I write the additional validation code? and
Should it go in Before or after update?
--
deb
:
See if this helps.
See if this helps.
not in the main form's code, but in the Before Update event on the
continuous subform, put code something like this untested air code.
If Me.[KeyMilestoneSubID] = 12 or KeyMilestoneSubID = 20 Then
If IsNull(Me.NameOfMilestoneField) Then
Cancel = True
Msgbox "Milestone required"
End If
End If
Replace NameOfMilestoneField with the appropriate control/field name.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
When I put the validation in the subform before or after update, there
When I put the validation in the subform before or after update, there is
nothing to make the form dirty so the user can exit without touching the
subform. How can I make the form dirty so it will trigger the validation?
I tried putting it in the main form after update but it put me in a loop
that would not let me click on the subform without the msg popping up so I
could not enter data into the subform.
Wow this should not be so difficult. It is making me crazy.
--
deb
:
Not sure why you are using a subform where no data entry is required.
Not sure why you are using a subform where no data entry is required. Would
you explain a bit more about what you are trying to do.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
EggHeadCafe - Software Developer Portal of Choice
Kill Running Process in ASP.NET [C# - Beta 2]
http://www.eggheadcafe.com/tutorial...7-4c140e45d48c/kill-running-process-in-a.aspx