parameter problem

N

Nabeel

Hi,
I need to pass parameter to a stored procedure, based on values of a text
box in a form, how can it be done? The stored procedure runs fine with named
parameters.
 
N

Nabeel

This Stored procedure is not used as a data source of a form, actually i
want run a make table query based on a value in text field of a form. where
i press a command button and the table is made. I used to get this done in
Access by referring to the field on form in the query . . but this approach
does not seem to work in .adp
 
B

bobby

If I understand you correctly, I would suggest to use a command object (with
parameters) to call the stored procedure. The stored procedure can then
create the table.

Set com = New ADODB.Command
com.ActiveConnection = CurrentProject.Connection
com.CommandType = adCmdStoredProc
com.CommandText = "sp_MySproc"
com.Parameters.Refresh 'note this causes another visit to the
back end
com.Parameters("@param1") = Me.txtParam1
com.Parameters("@param2") = Me.txtParam2
com.Execute
 
N

Nabeel

I tried the code it gives the following error
"Cannot run SELECT INTO this database. The database owner must run
sp_dboption to enable this option"
I have been using Access but never had this problem. Please help

BTW I tried the same code with a select query, it doesn't show me any
result.
 
B

bobby

please post the code that gives the error

Nabeel said:
I tried the code it gives the following error
"Cannot run SELECT INTO this database. The database owner must run
sp_dboption to enable this option"
I have been using Access but never had this problem. Please help

BTW I tried the same code with a select query, it doesn't show me any
result.
 
N

Nabeel

Found the error in code and solved the problem. . . . .
but one problem still remains How do i run "sp_dboption " to make sql server
enable make table queries.....

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top