469,928 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

Validating based on data in Parent Form and Subform

1
Hi,
Windows MSAccess2003 is not recognizing the subform field that I want to include in my validation.

The Main form has an Account# as PrimaryID and a Start Date & End Date.
The subform has a one-to-many relationship on the Account#, and also has the Detail Budget Data.

I would like to validate a statment that will prohibit updating a budget record if the dates are not filled in (BeforeUpdate):
Macro Condition:
[Start Date] is null AND [Budget Detail] Is Not Null
Macro Action: MsgBox "Need to enter Dates if entering Budget data"
Macro Action: CancelEvent

How can I get Access to recognize the subform field for this type of comparison?

Much obliged for any assistance.
Nov 7 '07 #1
1 3223
MMcCarthy
14,534 Expert Mod 8TB
The subform object has two events only and enter and exit event. In the enter event you need to put something like the following:

Something like ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub subformObjectName_Enter()
  2.  
  3.     If IsNull(Me.StartDate) OR IsNull(Me.EndDate) Then
  4.         MsgBox "You must enter a StartDate and EndDate", vbOKOnly
  5.         Me.StartDate.SetFocus
  6.     End If
  7.  
  8. End Sub
  9.  
Nov 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Gary Shell | last post: by
1 post views Thread by kenduron | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.