473,396 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Runtime Error5 :Invalid Procedure Call

When i'm trying to exute a piece of code it's giving this error. Please help me on this. i'm in desperate need of this.
Code snippet:

dim rst as recordset
dim db as database

Set rst = db.OpenRecordset("select * from qrySelect",dbOpenSnapshot)
Jan 12 '07 #1
8 4125
NeoPa
32,556 Expert Mod 16PB
At this point db is set to Nothing.
Try using CurrentDB.OpenRecordset or setting db first.
Jan 12 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Firstly check that the Microsoft DAO library is ticked on the references list. You will find this on the Tools menu in the VB Editor window.

Then the code is as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim rst As Recordset
  2. Dim db As DAO.Database
  3.  
  4. Set db = CurrentDB
  5. Set rst = db.OpenRecordset("select * from qrySelect",dbOpenSnapshot)
  6.  
Jan 12 '07 #3
hi

This is related to your suggestion for Invalid procedure call in ms access. I tried by setting it as a new datbase but it's giving an error ' wrong usage of New keyword'. here is the snipet(original) of the code used. please let me know where to modify.

Expand|Select|Wrap|Line Numbers
  1. Dim db As Database
  2. Dim rst As Recordset
  3.  
  4. Set db = DBEngine(0)(0)
  5.  
  6. Set rst = db.OpenRecordset("select * from qrySelect_CostDifferences", dbOpenSnapshot)
Please help me on this.

regards,
garimella
Jan 18 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
hi

This is related to your suggestion for Invalid procedure call in ms access. I tried by setting it as a new datbase but it's giving an error ' wrong usage of New keyword'. here is the snipet(original) of the code used. please let me know where to modify.

Expand|Select|Wrap|Line Numbers
  1. Dim db As Database
  2. Dim rst As Recordset
  3.  
  4. Set db = DBEngine(0)(0)
  5.  
  6. Set rst = db.OpenRecordset("select * from qrySelect_CostDifferences", dbOpenSnapshot)
Please help me on this.

regards,
garimella
garimella

I used Set db = CurrentDB not DBEngine(0)(0)
Jan 18 '07 #5
Hi

I tried db=CurrentDb(), but it didn't work it's still giving that error. I've checked the project references, they are fine. This was running fine until Jan 10th. I don't why this started giving this error. I'm trying to run this query manually, not from the code, even then it's giving the same error. I've been trying to fix it for the last 10days but i couldn't, Please help me if there are any other things that does cause this error.

Regards,
Garimella
Jan 22 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
Hi

I tried db=CurrentDb(), but it didn't work it's still giving that error. I've checked the project references, they are fine. This was running fine until Jan 10th. I don't why this started giving this error. I'm trying to run this query manually, not from the code, even then it's giving the same error. I've been trying to fix it for the last 10days but i couldn't, Please help me if there are any other things that does cause this error.

Regards,
Garimella
Check that qrySelect exists as a query and check the spelling of the query.

Exactly which line is the code stopping at?
Jan 22 '07 #7
NeoPa
32,556 Expert Mod 16PB
Hi

I tried db=CurrentDb(), but it didn't work it's still giving that error. I've checked the project references, they are fine. This was running fine until Jan 10th. I don't why this started giving this error. I'm trying to run this query manually, not from the code, even then it's giving the same error. I've been trying to fix it for the last 10days but i couldn't, Please help me if there are any other things that does cause this error.

Regards,
Garimella
If it doesn't work for you when running it manually, when it did before (I assume), then there is something wrong.
You could try posting the SQL of the query here for a quick checkover, but it may well be an issue not directly related to your project.
Jan 23 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
Hi

I tried db=CurrentDb(), but it didn't work it's still giving that error. I've checked the project references, they are fine. This was running fine until Jan 10th. I don't why this started giving this error. I'm trying to run this query manually, not from the code, even then it's giving the same error. I've been trying to fix it for the last 10days but i couldn't, Please help me if there are any other things that does cause this error.

Regards,
Garimella
Sorry Garimella

Didn't read the last part of this post properly. It sounds like the problem exists in the query rather than the code. Open the query in design view then change the view to sql and copy and paste code here.

Mary
Jan 23 '07 #9

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

Similar topics

6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
5
by: PeteCresswell | last post by:
----------------------------------------------------------------- Sub Sheesh() Dim myYears As Double Dim myRawCumulative As Double Dim myAnnualizedROR As Double ...
19
by: sara | last post by:
I am trying to identify if a information in a details field (damagedetails; soildetails) has NOT been entered if the presence of damage or soil has been determined (check boxes: chkDamage and...
2
by: chitocute | last post by:
Hello, I'm currently maintaining a system software right now (done with visual basic 6.0) that runs on windows 98 flatform before. Time came when we upgraded to win2003 and accessed the server...
8
by: K Viltersten | last post by:
I've seen some people calling a stored procedure on MS SQL Server and intercepting an invalid parameter list by a switch statement, demanding that each of the parameters names is exactly as the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.