When you are referring to a subform, you have to "go
through the main form" to get to anything on it. for
example, consider that you are using...
frmMain, as the main form...ctlSubForm, as the CONTROL on
the main form and "holds" the sub-form...frmSubForm, as
your sub-form
Then, to reference the subform, you need to use, for some
examples...
Forms![frmMain]![ctlSubForm].Form.Undo
Forms![frmMain]![ctlSubForm].Form.RecordSource = ""
Forms![frmMain]![ctlSubForm].Form![ctlCombo] = "Blue"
Get the idea there ?
Rodney M. Gabriel
Quote:
>-----Original Message-----
>Hi. I am trying to make sure that a field is completed
>based on the data in another field. Both of the fields
>are on a subform.
>Specifically, if combo81 (status type) is "1" (awarded)
>then I want NextSubmittalDate to be required.
>I'm trying:
>Private Sub Form_BeforeUpdate(Cancel As Integer)
>Dim iAns As Integer
>If Combo81 = 1 Then
> 'status is Awarded
> If Len(Trim$(NextSubmittalDate & vbNullString)) > 0
>Then
> 'there is something in NextSubmittalDate
>Else
> iAns = MsgBox("Please enter an 'Apply Again' Date to
>continue, or click Cancel to erase this record",
>vbOKCancel)
> If iAns = vbOK Then
> Cancel = True
> NextSubmittalDate.SetFocus
> Else
> Cancel = True
> Me.Undo ' erase the entire form
> End If
> End If
>End If
>End Sub
>In this case, Undo isn't undoing. I've used something
>similar in the past but on the main form, not the
>subform. I'm not all that interested in the data being
>wiped out, so I'd take suggestions of how to make the
>field required based on the other field without getting
in
>an endless debugging loop.
>If you have a suggestion please be VERY explicit.
>Thanks, Steph
>.