Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Record Source of Sub Form

Status
Not open for further replies.

SGTSweety

Programmer
Oct 25, 2003
24
US
Couldn't find anything in FAQ's or other's posts.

I failed to plan ahead and built a form/subform which I would now like to change the Record Source from a table to a query. The forms work just swimmingly while the SubForm keeps the original record source.

Existing Condition:

Main Form - frmCalendar (Unbound)
Sub Form - frmCalendarHours (Bound-tblFirmData)

No Link Master/Child Field exists. I couldn't figure how to accurately write code for this, although I seen mention of the possibility in other reponses in TEK-TIPS. The issues appeared to be resolved when I found update tips in other missives.

Common link is through
MainForm - DateVal
(Unbound)
SubForm - vDateVal
(Control Source =Forms!frmCalendar!DateVal)

SubForm updated by
Me.frmCalendarHours_sub.Form.Recalc
(Updates vDataVal )
Form_frmCalendarHours.CalUpdate
(Public Routine-Rebuilds remainder of SubForm)

I would like to change the record source of the subform to a query which includes tblFirmData and 5 other tables. The five tables are related in one form or another. tblFirmData has no relations. qryApptCal use soley to join tables and only use the '*'. When I open main form, I get:

'Too many fields defined.' on open.
'Run-time error '424. Object required.' for:
MainForm:
Me.frmCalendarHours_sub.Form.Recalc
Form_frmCalendarHours.CalUpdate.
SubForm:
txtBox objects with ControlSource from tblFirmData. These txtBox objects are no longer listed List Methods/Properties drop-down menu in Visual Basic Editor. If I add the tblFirmData fields used in the SubForm to qryApptCal, the problems all go away, except for the object required error on the MainForm:
Me.frmCalendarHours_sub.Form.Recalc

Thank you so much for your assistance.

Steven
Raise the bar. When you reach, raise it again.
 
NEVER MIND! I rebuilt the query from scratch - again. Everything is working just fine. I obviously fat-fingered something or did something incredibly stupid (most likely a healthy combination of both).

Sorry to have bothered you.

Thanks again,
Steven

Raise the bar. When you reach it, raise it again. Just don't trip over it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top