Arthur Fuller
artful at rogers.com
Fri Feb 21 07:53:43 CST 2003
I'm not sure whether I understood you correctly, but I have taken to coding "double-function" sprocs in the following way: CREATE PROCEDURE myProc ( @pk int = 0 ) AS SELECT * FROM someTables WHERE (@pk = 0) OR (someTable.pk = @pk) For all rows, pass a zero in as @pk. For just some, pass any other legitimate value. Incidentally, you can also write the above defaulting @pk to NULL and changing the first test to "@pk IS NULL". Same result. I think this is what you need. Give it a try. Hth, Arthur -----Original Message----- From: dba-sqlserver-admin at databaseadvisors.com [mailto:dba-sqlserver-admin at databaseadvisors.com] On Behalf Of David Emerson Sent: February 20, 2003 10:14 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer]Parameters when opening forms AXP ADP/SQL2K I have a form (Form2) that can be opened from two separate places in my FE. The first (Form1) requires only a specific customer's records to be viewed in Form2. The second (Form3) requires all customers records to be viewed in Form2. The source is a stored procedure which used a parameter to select the specific customers records. Form1 has the customer showing and when it opens Form2 it sends the CustomerID as an OpenArg to Form2 (eg "@CustIDNo int=992168150"). Form2 then places the OpenArg into its InputParameters property which is used by the stored procedure to only show the current customers records. Fine. The problem is with Form3. This is to open Form2 but show all customer records. I am having problems telling the sproc parameter that it should include all records. Am I tackling the problem the right way or is there a simpler way to do it (for example in mdb's just including or leaving off the WherCondition criteria in DoCmd.OpenForm). Regards David Emerson DALYN Software Ltd 25b Cunliffe St, Johnsonville Wellington, New Zealand Ph/Fax (877) 456-1205 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com