jwcolby
jwcolby at colbyconsulting.com
Tue Aug 28 12:12:12 CDT 2007
I think Charlotte is correct. What you have to do is clear the source object, set the master/child fields, then set the source object again. Never set / clear either of the master / child field properties with the source object property set. Basically what you also want to do is make sure each subform will load NOT JIT first, get everything correct there, then do it in the order shown above. I have JIT built in to my framework and so the code always does it in this order and I do not experience problems. I do literally dozens of different JIT subforms. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Tuesday, August 28, 2007 12:48 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] JIT SubForms I ran into this some years ago. The master child fields can't be changed on the fly, if I remember correctly, so you can only set them if there is no sourceobject. I made sure that all the JIT subforms for a particular tab used the same master/child links and then added something like this: strSrcObject = "fsbDailyRigInfo" If Len(Me.fsbDailyRigInfo.SourceObject) = 0 Or _ Me.fsbDailyRigInfo.SourceObject <> strSrcObject Then Me.fsbDailyRigInfo.SourceObject = strSrcObject If Len(Me.fsbDailyRigInfo.LinkMasterFields) = 0 Then Me.fsbDailyRigInfo.LinkMasterFields = "cboWellID;cboReportNo" End If If Len(Me.fsbDailyRigInfo.LinkChildFields) = 0 Then Me.fsbDailyRigInfo.LinkChildFields = "WellID;ReportNo" End If End If Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell Sent: Tuesday, August 28, 2007 9:28 AM To: Access Developers discussion and problem solving Subject: [AccessD] JIT SubForms I'm finally back in the development mode, from management mode, and have run into a problem with some JIT sub forms. I have a SubForm Control that can hold 1 of 5 subforms. I set the SourceObject, LinkChildFields and LinkMasterFields in code to change the subform. If I use one of the 3 that are similar (display, add and edit version), everything works just fine, but when I try and switch to a subform that is completely different, I get Parameter requests and errors popping up. It first asks for parameter that is one of the link fields (Child IIRC)., When I cancel the parameter request dialog I get an error 2101 The Setting you entered isn't valid for this property. The code actually DOES change it, but gives an error. This is the actual code I use: Me.sfmSubForm.SourceObject = "sfmShiftReport" Me.sfmSubForm.LinkChildFields = "ShiftReportDate" Me.sfmSubForm.LinkMasterFields = "txtShiftReportDate" I've tried setting all of these to an empty string first. No Joy, the error still appears. I've tried various orders of setting things, and "unsetting" them. Still get the error. Does anyone have any insight to why this isn't working for me? Thanks, -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com