[dba-VB] Does anyone have

jwcolby jwcolby at colbyconsulting.com
Mon Dec 10 13:54:26 CST 2007


Charlotte,

I found the answer in the data sources object.  Drag and drop Detail onto
the form and voila a "bound" data form.  Good enough for now.

OTOH, there is now the issue of the child form.  I have ExportSpec which
defines the export of data.  I have ExportMap which defines field level info
about a specific ExportSpec.  I now know how to build a form to display
ExportSpec, and I can also now build a form for ExportMap, but I need to
open frmExportMap and filter the data in ExportMap to just the child records
of the current ExportSpec.  It would be nice but certainly not a requirement
to embed frmExportMap in frmExportSpec a la Access.


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Monday, December 10, 2007 2:32 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] Does anyone have

John, 

Can't recommend a tutorial offhand, but we do this all the time.  You
normally bind the form to a dataset at design time, but you can do it after
the fact if necessary. Question is, what exactly do you mean by "create on
the form" and then somehow bind?  Are you talking about dropping controls on
the form at runtime, a la a control array in VB, or something else?  In
either case, the keyword is DataBindings, which will allow you to take a new
recordset and set the objects binding to that recordset.  What we do is
declare a couple of object variables as bindings, one old and one new.  Then
we create an arraylist for bindings to remove and bindings to add.  After
that, it's a matter of stepping through the controls, identifying the bound
controls and examining their binding.  If the oldbinding DataSource is the
old datasource, then we populate NewBindings with a new binding using the
original binding property name but the new datasource without removing the
old binding.
We add the original binding to the oldbindings arraylist and the new binding
to the newbindings arraylist.  When that's all done, we remove the old
bindings and add the new ones.

Charlotte Foust




More information about the dba-VB mailing list