By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 2,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Using References to User Entered Data

P: 3
@ADezii
is there a way to get this docmd.outputto command to pass the parameters through code, instead of having to type them in? My end users are not that SQL savvy. I would rather pass the stored procedure parameters that they have already entered into text boxes on the access form.
Jan 6 '09 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,489
Any parameter that is passed a string (text within the " characters) in ADezii's code can also be passed anything that refers to a string variable. Try replacing the string parameter you want the user to enter with a reference to the control on your form (See Referring to Items on a Sub-Form).

Welcome to Bytes!

PS. This thread was split off from http://bytes.com/topic/access/answer...rocedure-excel
Jan 6 '09 #2

P: 3
I understand how to reference the textbox values.

I just couldn't figure out how to put the parameters into the procedure call for the excel export.

However, I just tested it by adding the sql EXEC command before the stored procedure name:
Expand|Select|Wrap|Line Numbers
  1. docmd.OutputTo acOutputStoredProcedure,"exec sps_LoadBuilder '" & me.txtStartDate.value & "','" & me.txtEndDate.value & "'," & me.txtViewValue.value,acformatxls
now it works. Thanks.
Jan 7 '09 #3

NeoPa
Expert Mod 15k+
P: 31,489
I can't see that the "Exec" would be necessary, but your before and after images are not of the same thing so I can't do a matching alternative for you to try.

I expect you're not fussed about such details anyway, and you have a working solution, so good for you and I won't worry about digging in further unless you decide you're interested in the finer details.
Jan 7 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.