Charlotte Foust
cfoust at infostatsystems.com
Mon Dec 10 14:55:26 CST 2007
We do that, John, but we create usercontrols for subforms. Our UI objects,forms and subform usercontrols show up in the toolbox, and we simply drag them onto a form as needed. You can embed a form within a form, but when you use it as a usercontrol, you lose some of the methods and properties. We generally put a FillData routine (or some such) into a form or usercontrol where we want to filter the records and pass in the parameters needed to retrieve the right dataset. When the parameters change through navigation, we pass in the new parameters. If the dataset is already filled, you can pass it as an object to the usercontrol and then just adjust the data bindings in the usercontrol to point at the passed dataset. Charlotte Foust -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Monday, December 10, 2007 11:54 AM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Does anyone have 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 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com