S
speaton via AccessMonster.com
Hello,
I have a form into which summary data is entered, on which there is a
datasheet-style subform for entering related records. In many cases, one of
the fields in the main form makes a handy default value for many (but not all)
of the records in the subform, so I would like to have a field on the subform
take its value from a field on the main form when it acquires focus (assuming
that it doesn't already have a value).
It seems like something along the lines of the example below should do the
trick, but Access keeps telling me it cannot find the subform in question
(which is present in the database--I've checked!):
---
Private Sub SubformField_Enter()
Dim SubformValue as String
Dim MainFormValue as String
SubformValue = Forms! ' ... path to the subform field goes here
MainFormValue = Forms! ' ... path to the main field goes here
If IsNull(SubformValue) Then SubformField = MainFormValue
End Sub
---
Can anyone point out what might be causing the problem? Better still, can
anyone suggest a better way of implementing this idea?
With many thanks in advance,
speaton
I have a form into which summary data is entered, on which there is a
datasheet-style subform for entering related records. In many cases, one of
the fields in the main form makes a handy default value for many (but not all)
of the records in the subform, so I would like to have a field on the subform
take its value from a field on the main form when it acquires focus (assuming
that it doesn't already have a value).
It seems like something along the lines of the example below should do the
trick, but Access keeps telling me it cannot find the subform in question
(which is present in the database--I've checked!):
---
Private Sub SubformField_Enter()
Dim SubformValue as String
Dim MainFormValue as String
SubformValue = Forms! ' ... path to the subform field goes here
MainFormValue = Forms! ' ... path to the main field goes here
If IsNull(SubformValue) Then SubformField = MainFormValue
End Sub
---
Can anyone point out what might be causing the problem? Better still, can
anyone suggest a better way of implementing this idea?
With many thanks in advance,
speaton