[dba-VB] Open a filtered form

Charlotte Foust cfoust at infostatsystems.com
Tue Dec 11 12:16:57 CST 2007


We are, but a lot of our code would make no sense outside the context of
our framework.  Our dataentities (classes that wrap and implement a
typeddataset) return a dataset with defaults for the primary keys when
appropriate.  They also enforce the business rules that prevent saving a
record without filling in required fields.  We use a NewRecord routine
in the form when we need to create a new datarow and populate those
values and any other required values before adding the row to the
dataset.  

You can hide columns in the grid without removing them from the dataset.
And you can use SQL and ADO to create a recordset with only the specific
fields provided for in the commandtext.  Our OleDbProvider project
includes the standard SQL for filling datasets as defined by the
interface classes in the data project.  It also includes data provider
classes that implement the interfaces and actually return the filled
datasets to the data entities.

So, in short, code in the form sets the datasource of the grid to the
dataset object, but the dataset object is filled in the OleDbProvider
classes and handed back to the dataentity class bound to the form.  We
usually bind a grid to a dataview because it's easy to filter down to
just the records you need and it gives you lots of control over the
behavior.

In many ways it's just like Access, especially if you have a rich data
layer to program against instead of going straight against the objects
exposed in Server Explorer.  You can program against that with full
intellisense without being attached to a database until you run the
application.

Charlotte Foust

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Tuesday, December 11, 2007 8:51 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] Open a filtered form

Someone here must be opening forms filtered down to a set of records?  I
need to select a record in a main form and then open another form
filtered to records related to the main form.  The equivalent of the
popup filtered forms from Access.

Can anyone show code to cause this to happen?  

Let's assume for the moment a grid control in the popup form.

I assume code in the form will create a data set object and bind the
grid to that.  I don't want the whole table though, I only want a set of
records, a WHERE.  And if I enter records I need the PKID from the
parent table automagically entered in the new records I am creating.
And I don't want the FK field from the parent object displayed in the
grid.

You know, "just like Access does it", and of course "just like you would
logically expect it to be done".

Is anyone doing this stuff?

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list