[dba-SQLServer]Bound forms filtered on a control on the form

Susan Zeller szeller at cce.umn.edu
Wed Feb 26 11:45:32 CST 2003


John,

For the combo boxes, you can just put after_update of cboMyCombo1.

strMyParameter = me.cboMyCombo1.value
Me.cboMyCombo2.rowsource = "Exec dbo.MySproc " & strMyParameter

HTH.

--Susan


>  -----Original Message-----
> From: 	dba-sqlserver-admin at databaseadvisors.com
> [mailto:dba-sqlserver-admin at databaseadvisors.com]  On Behalf Of John
> W. Colby
> Sent:	Wednesday, February 26, 2003 9:28 AM
> To:	dba-sqlserver at databaseadvisors.com
> Subject:	RE: [dba-SQLServer]Bound forms filtered on a control on
> the form
> 
> Well, I hit send too soon.  I see it as a property of the me object in
> code.  That solves my problem I guess. It doesn't appear to be
> available at design time but I can program it no problem. 
> 
> Next question, how do I do the same thing for a combo?  If a combo is
> filtered on another combo, the second combo is based on a stored
> procedure that has an input parameter so that it can filter down based
> on something passed in.  The "something passed in" is the value of
> another control.
> 
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
> 
> -----Original Message-----
> From: dba-sqlserver-admin at databaseadvisors.com
> [mailto:dba-sqlserver-admin at databaseadvisors.com]On Behalf Of Susan
> Zeller
> Sent: Wednesday, February 26, 2003 10:12 AM
> To: dba-sqlserver at databaseadvisors.com
> Subject: RE: [dba-SQLServer]Bound forms filtered on a control on the
> form
> 
> 
> Input Parameters is a property of the form, even in A2K and you can
> set
> it on the form or in code with me.inputparameters = .....  Don't have
> much more to offer on this as I've been working mostly with unbound
> forms since I moved to SQL/Adp's.  
> 
> --Susan
> 
> >  -----Original Message-----
> > From: 	dba-sqlserver-admin at databaseadvisors.com
> > [mailto:dba-sqlserver-admin at databaseadvisors.com]  On Behalf Of John
> > W. Colby
> > Sent:	Wednesday, February 26, 2003 8:57 AM
> > To:	dba-sqlserver at databaseadvisors.com
> > Subject:	RE: [dba-SQLServer]Bound forms filtered on a control on
> > the form
> > 
> > >I think there's some misunderstanding here (could be on my part J).
> > Does your form have, say, a combo or list that is the form's
> > navigation scheme? Such that you select a row in the list and then
> the
> > form navigates to that record?
> > 
> > Precisely.  this is just one scenario that I actually need to handle
> > in my databases, to port them to ADPs.
> > 
> > >In the InputParameters property, write "@PK = " & Me.cboName. 
> > 
> > I guess what I don't understand is that the sproc looks like a query
> > from inside the ADP.  The form is bound to the sproc (query), but
> how
> > do I feed the parameter to the sproc?  Where is the "Input
> Parameters
> > property"?  What is it a property of?  Do I assign the sproc to an
> ado
> > object which has such a property, then assign that to the form's
> > recordset property?  If I do that, is the form R/W?  If that is what
> I
> > do (and it must be R/W to be useful) can I see some example code?
> > 
> > John W. Colby
> > Colby Consulting
> > www.ColbyConsulting.com
> > 
> >  -----Original Message-----
> > From: 	dba-sqlserver-admin at databaseadvisors.com
> > [mailto:dba-sqlserver-admin at databaseadvisors.com] 
> > Sent:	Wednesday, February 26, 2003 8:06 AM
> > To:	dba-sqlserver at databaseadvisors.com
> > Subject:	RE: [dba-SQLServer]Bound forms filtered on a control on
> > the form
> > 
> > I think there's some misunderstanding here (could be on my part J).
> > Does your form have, say, a combo or list that is the form's
> > navigation scheme? Such that you select a row in the list and then
> the
> > form navigates to that record? Or are you passing the selection to
> > another form that you want to filter?
> > If it's the same form, you'll need:
> > a)	a view or sproc that populates the list with PK and description;
> > b)	a sproc that drives the form, and that accepts an int parameter
> > @PK. Within the sproc, default the parameter @PK to zero.
> > 
> > The code for the sproc should resemble this:
> > CREATE PROC myProc
> > ( @PK integer = 0)
> > AS
> > SELECT * FROM myTables
> > WHERE (PK = @PK)
> > 
> > In the InputParameters property, write "@PK = " & Me.cboName. In the
> > AfterUpdate event of cboName, requery the form.
> > It's dead simple, and leaves all the data you don't want on the
> server
> > where it belongs.
> > HTH,
> > Arthur
> > 
> > -----Original Message-----
> > From: dba-sqlserver-admin at databaseadvisors.com
> > [mailto:dba-sqlserver-admin at databaseadvisors.com] 
> > Sent: February 25, 2003 7:08 PM
> > To: dba-sqlserver at databaseadvisors.com
> > Subject: RE: [dba-SQLServer]Bound forms filtered on a control on the
> > form
> > 
> > Hmmm... OK.  My understanding is that this actually pulls all of the
> > records in the recordset and then only DISPLAYS one record (filter).
> > That is useful in certain instances, however I would really like to
> > just pull one specific record, having SQL Server do all the work of
> > finding that record and handing it back.
> > 
> > John W. Colby
> > Colby Consulting
> > www.ColbyConsulting.com
> > 
> > -----Original Message-----
> > From: dba-sqlserver-admin at databaseadvisors.com
> > [mailto:dba-sqlserver-admin at databaseadvisors.com]On Behalf Of Selina
> > Iddon
> > Sent: Tuesday, February 25, 2003 5:31 PM
> > To: dba-sqlserver at databaseadvisors.com
> > Subject: Re: [dba-SQLServer]Bound forms filtered on a control on the
> > form
> > 
> > 
> > Hi John
> > I may be reading the question wrong, but would this help?
> > 
> > Sub MyComboControl_AfterUpdate()
> > Me.Filter = "FieldName = " & Me.MyComboControl
> > Me.FilterOn = true
> > End Sub
> > 
> > Cheers
> > Selina
> > 
> > 
> >
> ----------------------------------------------------------------------
> > ------
> > ---- Selina Iddon selina at easydatabases.com.au Ph: 0414 225 265 Easy
> > Access
> > Databases
> > ----- Original Message -----
> > From: "John W. Colby" <jcolby at colbyconsulting.com>
> > To: "AccessD-SQLServer" <dba-sqlserver at databaseadvisors.com>
> > Sent: Wednesday, February 26, 2003 7:53 AM
> > Subject: [dba-SQLServer]Bound forms filtered on a control on the
> form
> > 
> > 
> > > I have been following the thread on the report thing.  The
> > discussion has
> > > focused (the ones I have read) on using XP, where there are
> actually
> > > properties to do this.  How do I do this in A2K?
> > >
> > > I have a form.  I want to select a record in a combo box.  Having
> > selected
> > > that record, I want to run an sproc, passing a parameter to filter
> > the
> > data
> > > returned to only return the record selected in the combo box.
> > >
> > > How do I do that in A2K?
> > >
> > > John W. Colby
> > > Colby Consulting
> > > www.ColbyConsulting.com
> > >
> > > ----------------------------------------------------
> > > Is email taking over your day?  Manage your time with eMailBoss.
> > > Try it free!  http://www.eMailBoss.com
> > >
> > >
> > > _______________________________________________
> > > dba-SQLServer mailing list
> > > dba-SQLServer at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > http://www.databaseadvisors.com
> > >
> > >
> > >
> > 
> > 
> > _______________________________________________
> > dba-SQLServer mailing list
> > dba-SQLServer at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > http://www.databaseadvisors.com
> > 
> > 
> > 
> > 
> > ----------------------------------------------------
> > Is email taking over your day?  Manage your time with eMailBoss.  
> > Try it free!  http://www.eMailBoss.com
> > 
> > ----------------------------------------------------
> > Is email taking over your day?  Manage your time with eMailBoss.  
> > Try it free!  http://www.eMailBoss.com
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 
> 
> 
> ----------------------------------------------------
> Is email taking over your day?  Manage your time with eMailBoss.  
> Try it free!  http://www.eMailBoss.com



More information about the dba-SQLServer mailing list