thanks for your reply, but my form is in access, what i did was i created
a
[quoted text clipped - 3 lines]
Yes, but in the above, you don't explain what the form is linked to
now...are you creating a reocrdset as a result of a pass-thoughquery, or
stored proc, and THEN assigning that reocrdset to the forms data source
(this is one appoarch...). (it is not clear at all how you are doing the
above...).
Also, while we are at this...what version of ms-access, and are you using a
mdb with linked tables...or a ADP project? Again, a adp, or a mdb to sql
server are VERY MUCH differnt here....
there has to be an easier way just to link the access form directly to the
sp?
correct?
Well, as mentioned, just link the form to a view. Then open the form using
the "where" clause. You made no case, or arguments as to why you are using a
SP now. You can use a view with no parameters, and use the form/reports
ability to have parameters on the fly via the "where" clause. That way, you
can change, or add, or have any new conditions you want..and you don't have
to run around like a chicken writing a new stored proc each time you have
some new condition for a form...
another question:
my stored procedure has an input parameter :
[quoted text clipped - 14 lines]
in
the sql pass through query?
are you planning to send the reuslts to a reprot, or a form? (or both?).
The simple solution again is to supply the prompts on the ms-access
side..and also supply the conditions on the ms-access side...
don't hard code the parameters as you have..since then you always have to
supply them!!! As mentioned, link the form (or report)
to a view (Again, not clear if you are using a adp, or a mdb file with
linked tables to sql server).
Regardless of a adp/mdb, you simply promt the user in ms-access, and then
pass that..
eg:
strStartDate = inputbox("enter start Date")
strEndDate = inputbox("enter end date")
Then simply create a pass-thougth query such as
strMyExec = "exec myreprot '" & strStartDate & "', '" & strEndDate & "'"
(you need to use # in place of the above ' if you are using linked tables
from a mdb appcation to sql server. If using adp..aobve shouild be ok..
However, once again, I don't see why a SP is being used here...
You will find it MUCH easier to simply create the query sql side WITHOUT any
parameters and save that as a view. You then create a linked table (I am
assuming you are NOT using a adp project here), or if using a adp..just use
that view.
So, dump the use of store proc , and dump the use of parameters.....you
don't need them....
simply use the reports (or forms) "where" clause to open the form, or
report.
eg:
strWhere = "Invoice_Date >= '" & strStartDate & "' and Invoice_Date <= '" &
strEndDate & "'"
docmd.OpenForm "frmInvoices",,,strWhere
And, you can do do the same type of filtering for reprots
docmd.openReprot "invoices",,,strWhere
As mentioned, use # in place of ' in the above if you are using a mdb file
to sql server....
So, check out the use of the "where" clause when you open a form, or a
report. This approach will elimonate the need to write a zillion little
stored procs everywhere here and there....