[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DoCmd.OpenStoredProcedure can't find the object

Posted on 2009-07-10
11
Medium Priority
?
1,342 Views
Last Modified: 2013-12-05
In an Access database project form I have this little piece of code

            DoCmd.SetWarnings False
            DoCmd.Close acForm, "View_Edit_Tree"
            DoCmd.SetWarnings True
            DoEvents
            DoCmd.OpenStoredProcedure "dbo.sp_Search_All"
            DoCmd.Maximize

And at runtime the following error is returned "can't find the object 'dbo.sp_Search_All' ", error number 7874

The stored procedure exists in the database and expects one parameter.

Can you tell me why it doesn't see/execute it?
Thank you
0
Comment
Question by:miral13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
11 Comments
 
LVL 85
ID: 24823280
I'm not sure you can pass parameters with the DoCmd method ... but I don't know, as I've never opened SPs in this manner. I typically use a simple Recordset object, or a Command object:

Dim cmd As ADODB.Command

Set cmd = New ADODB.Command

With cmd
  Set .ActiveConnection = CurrentProject.Connection
  .CommandText = "dbo.sp_SearchAll"
  .CommandType = adCmdStoredProc
  .Parameters.Refresh
  .Parameters(0).Value = "Your Value Here"
  .Execute
  Set .ActiveConnection = Nothing
End With

Set cmd = Nothing
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 24826966
Maybe the owner of the stored procedure is not dbo?

The recommended method is to create a form with the stored procedure as record source. Same with openview, opentable etc.
0
 
LVL 85
ID: 25504302
miral13,

You failed to respond to 2 Expert comments, either of which provided alternatives to your current issue (and vadimrapp1's comment was most likely your answer).

Did you solve this issue? If so, then please post your solution.

Did you attempt to close this question so that you could avoid the account lockout policy in regards to abandoned questions? I see that you've posted a new question just today.

0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:miral13
ID: 25504322
The issue was solved by refreshing the view.
0
 

Author Comment

by:miral13
ID: 25504341
The stored procedure in the code above was calling a view. After the view was refreshed everything worked. I hope it is clear.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 25511035
>> After the view was refreshed everything worked.<<
Could explain how the VIEW was "refreshed"?  You can re-compile a Stored Procedure, but I have never heard of refreshing a VIEW, at least in the context you describe.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 25511589
He refreshed the database view in Access, so Access learned about new view that was created outside of it in the database.

Sometimes people resolve their own questions by hitting F5, scrolling down the page to see what was down there, restarting the computer, etc. - works better than all us experts combined, once they finally get themselves together to do it (after posting the question and having some discussion).
0
 

Accepted Solution

by:
miral13 earned 0 total points
ID: 25512766
The ADP project was connecting to a SQL Server database.
The stored procedure from the code above was referencing a view.
The view was refreshed with sp_refreshview and after that Access was able to find the stored procedure also.
I hope it makes more sense now.
0
 
LVL 85
ID: 25513451
<works better than all us experts combined>

How true!

miral13, glad you reached a solution but in the future please post a short comment if you're deleteing your question, and please respond to Expert comments, even if it's to say that you've solved the issue.

IMO you should PAQ this question by accepting your own answer here: http:#25512766. This would be something that someone else might be able to use one day. If you PAQ and accept your own comment, your points will be refunded to you.

If you'd like to do that, then click the Object button, and then choose your own solution as the Answer and enter something like "found my own solution" in the Reason. This will close out the question in a few days, and keep that question in the PAQ.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question