How to set a subform date from a parent field?

W

WDSnews

I'm having trouble referencing an unbound field on a parent form to set a
date field in the subform. My child table has a date field called "Return
Date". On the subform I named it 'fldReturnDate'. There is an unbound
field on the parent-form named 'fldUseDate'. A third field of interest is a
logical Yes/No field named 'chkReturned' on the subform.

I'm capturing the 'After Update' event on the checkmark of 'chkReturned' to
set 'fldReturnDate', based on data in 'fldUseDate'. Here's what happens.
Upon running the form, I enter a date such as 06/10/2008 in the fldUseDate
field. Then when I check a box in chkReturned on the subform, it basically
enters a zero date in fldReturnDate. (i.e. it enters 12:00:00 PM). I
can't use the 'Now' function, because most times a user-entered date is
needed.

My code:

Private Sub chkReturned_AfterUpdate()
If chkReturned Then
fldReturnDate = fldUseDate
Else
fldReturnDate = ""
End If
End Sub

I suspect I'm lacking a Parent reference. ? Your help is appreciated.
 
B

Beetle

Private Sub chkReturned_AfterUpdate()
If chkReturned Then
Me!fldReturnDate = Me.Parent!fldUseDate
Else
Me!fldReturnDate = Null
End If
End Sub
 
W

WDSnews

thank you. !



Beetle said:
Private Sub chkReturned_AfterUpdate()
If chkReturned Then
Me!fldReturnDate = Me.Parent!fldUseDate
Else
Me!fldReturnDate = Null
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top