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

John W. Colby jcolby at colbyconsulting.com
Wed Feb 26 08:57:27 CST 2003


>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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3748 bytes
Desc: not available
URL: <http://databaseadvisors.com/pipermail/dba-sqlserver/attachments/20030226/6abb5267/attachment.bin>


More information about the dba-SQLServer mailing list