Another VBA checkbox/record question

  • Thread starter Thread starter Newboy
  • Start date Start date
N

Newboy

Hi, My database is coming along quite well but I have
another problem.
My continous form shows my Contacts with a button that
opens a popup window so that I can enter any orders, this
is now working well but I can't see from the Contacts
Form which contacts have Orders so I wanted to add a
checkbox that would be checked if that Contact had any
records in the Orders table.
I guess an Event Procedure linked to the Close button of
the Orders form would be best, something like if there
are any records for the Order then set a field in the
Contact table.
Please help, I have been trying all day and not got any
where at all.
 
My problem is that on my Orders Form I can access the
fields on its subform
Access says it cant find the Form AgreementTrialSubform

Dim varDate As Variant
varDate = Forms!AgreementTrialSubform!REPORT_YEAR
 
Newboy said:
My problem is that on my Orders Form I can access the
fields on its subform
Access says it cant find the Form AgreementTrialSubform

Dim varDate As Variant
varDate = Forms!AgreementTrialSubform!REPORT_YEAR


A subfrom is not a member of the Forms collection, which
consists only of forms that are opened directly to the
Access window.

Subforms are referred to through the subform control (on the
main form) that is displaying the form specified in its
SourceObject property.

varDate = Me.AgreementTrialSubform.Form!REPORT_YEAR

Note that the name of the subform control may be different
than the form that it is displaying, so double check the
subform control's name.
 
Thanks,
This has helped me a lot, can I apply the same principle
to the VBA that is being used to open the Subform so that
the cursor can go straight to the first Control on the
Subform rather than the first control on the Form?

DoCmd.GoToControl Me.AgreementTrialSubform.Form!
REPORT_YEAR
 
I think I have don it:
Forms![AgreementTrials]![AgreementTrialSubform].SetFocus
DoCmd.GoToControl "REPORT_YEAR"
 
Back
Top