[AccessD] JIT SubForms

Bryan Carbonnell carbonnb at gmail.com
Tue Aug 28 13:30:22 CDT 2007


On 8/28/07, jwcolby <jwcolby at colbyconsulting.com> wrote:
> 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.

OK, let's see if I've got this right, this is my new code, that STILL
doesn't work without throwing an error 2101.

  Me.sfmSubForm.SourceObject = vbNullString
  Me.sfmSubForm.LinkChildFields = "" '<-- Error's Here
  Me.sfmSubForm.LinkMasterFields = "" ' <-And Here

  Me.sfmSubForm.LinkMasterFields = "txtShiftReportDate" ' <-And Here
  Me.sfmSubForm.LinkChildFields = "ShiftReportDate" ' <-And Here
  Me.sfmSubForm.SourceObject = "sfmShiftReport"

The weird thing is that the even though Access throws an error, the
value does actually get set.

I can work around the error bu sticking an
On Error Resume Next before everything gets set, and then restoring
the error handling after it all, but that just doesn't feel right.

Does this look right?

-- 
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!"



More information about the AccessD mailing list