473,883 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error opening a recordset

Seth Schrock
2,965 Recognized Expert Specialist
My goal is to see if I can open a table that is linked to another Access database so that I can test to make sure that the connection does exist and doesn't need reconnected to a different BE or just another location. It was suggested to first check if the file existed where I thought it should be and then see if I can open the recordset. If both come back true, then I'm good. Otherwise if one comes back false, then I need to reconnect to the BE. I have the code to test if the file exists and I now just need to figure out how to see if I can open the recordset.

Well, my stab at opening the recordset and trapping the error didn't work too well. I tried copying what MSDN had here, but I'm getting a Run-time error 3219: Invalid Operation on line 8 for some reason. Here is what I have:

Expand|Select|Wrap|Line Numbers
  1. Public Function Connected(strDBName As String) As Boolean
  2. Dim db As DAO.Database
  3. Dim rsTable As DAO.Recordset
  4.  
  5. 'On Error GoTo Err_SetValue
  6.  
  7. Set db = CurrentDb
  8. Set rsTable = db.OpenRecordset(strDBName, dbOpenTable)
  9.  
  10. Connected = True
  11.  
  12. Err_SetValue:
  13.     Connected = False
  14.  
  15. End Function
Line #5 is commented out so that I can see what the error is since otherwise it just skips to line #12. strDBName = tblTest which is the only table that I currently have in this test database (the name is correct).
Dec 12 '12
20 10014
NeoPa
32,584 Recognized Expert Moderator MVP
I guess that means you're limited to Help on the web. The old system on 2003 had a decent page where I got all the information from, that I've used in this thread. Certainly both formats are covered in the same page, but the parameters for each are explained and all available values discussed. I had a quick look on MSDN and what they have there now is truly chronic. Disgraceful really.
Dec 12 '12 #11
zmbd
5,501 Recognized Expert Moderator Expert
[F1]
Once help opens
Upper left corner search box
Enter terms
Use the dropdown (VERY VERY small button next to the search button... they're trying to hide this I think)
Select offline developers

You get much better help than the current online crud.
Discovered by accident and then ran accross the same information in one of the other access help sites.

>>>EDIT<<<
This will sometimes default BACK to the online search... don't know why... it just does.

I also goto the bottom right corner in the help window and click on the globe wherein I change that to "show content only from this computer" If I need the web to find the answer then I tend to do a much better search using one of the other search engines than MSOffice has provided thru their cruddy cloud vision. ... OR .... I come here :)
Dec 13 '12 #12
Seth Schrock
2,965 Recognized Expert Specialist
I either can't find the place that you are talking about or I don't have that option. I have two groups: online and on this computer. Under On this computer I have Access Help and Developer Reference. I chose Developer Reference and that did come up with some stuff. However it doesn't seem to be any different than what is online.

For TableDef.OpenRe cordset it says that it "Creates a new recordset object and appends it to the recordsets collection."

Database.OpenRe cordset says the exact same thing.
Dec 13 '12 #13
NeoPa
32,584 Recognized Expert Moderator MVP
Nice Z.
Seth:
For TableDef.OpenRe cordset it says that it "Creates a new recordset object and appends it to the recordsets collection."

Database.OpenRe cordset says the exact same thing.
That's no big surprise. It's true for both. Does it give you the parameters and what they do? That's the acid question.
Dec 13 '12 #14
Seth Schrock
2,965 Recognized Expert Specialist
I can't find a difference other than Database.OpenRe cordset has sample code and the other doesn't. Each have the following parameters:

Name
Type
Options
LockEdit

Both describe the parameters exactly the same.
Dec 13 '12 #15
NeoPa
32,584 Recognized Expert Moderator MVP
That's exactly what you need Seth, except the TableDef version including a Name parameter (which is simply incorrect). Do you have the link for that?
Dec 13 '12 #16
Seth Schrock
2,965 Recognized Expert Specialist
Well, let me put it this way. It says the syntax is
expression.OpenRecordset(Type, Options) but it then continues to describe the four parameters I listed. Here are the links:
TableDef.OpenRe cordset Method
Database.OpenRe cordset Method
Dec 13 '12 #17
NeoPa
32,584 Recognized Expert Moderator MVP
Thank you for the links.

Not impressive I'll grant you Seth, but it does include the information you need. The Syntax described at the top is accurate, even if, confusingly, it explains parameters that aren't available in that syntax. Low score for MS on their Help pages, especially after coming from a system where the quality was considerably higher, but enough to get you going using the methods. It's particularly upsetting as this will clearly effect newbies more than experienced developers, thus restricting the uptake of Access in new developers.
Dec 13 '12 #18
zmbd
5,501 Recognized Expert Moderator Expert
Seth:
This should work in V2007 as well as 2010.
As you can see from the picture.... there's just a few lines of information:


When I did this (as shown) the first thing I got was a list of about 20 or so items, I clicked on the first one just to see what was there and that is what is shown in the screen shot.

The other option is in the bottom corner of the help window... a little globe.
Attached Images
File Type: jpg bytesthread_945144_help.jpg (74.2 KB, 4627 views)
Dec 13 '12 #19
Seth Schrock
2,965 Recognized Expert Specialist
That is what I clicked on Z. However, in this case I didn't get any different results. I just posted the links for NeoPa since it was the same data and so that I didn't have to do screen shots and post them.
Dec 13 '12 #20

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

Similar topics

3
6713
by: g_mx6 | last post by:
I am not sure what I am doing wrong. I am trying to open a DSNLess connection and retrieve the data in an Excel sheet using ASP. Shouldnt be this complicated but I've been trying to get this to work. I have a named range called Sheet1. Please assist me in this. Below is the CODE and ERROR. <% '************CODE Dim oConn, oRs
8
5273
by: Drew | last post by:
This is a weird error, it seems if we reboot the web server, which is also the SQL server, I get this error, ADODB.Recordset (0x800A0E7A) Provider cannot be found. It may not be properly installed. /swvtc/CliDrAppts/detailDrAppts.asp, line 31 Now line 31 of my asp page is the connection string, so there is nothing that I can do to get my apps working again.
1
1441
by: Nagarajan | last post by:
Hello, I am trying to open an application as a VS . NET Project . I get this error every time "Cannot create the offline cache in C:\Documents and Settings\TEMP\My Documents\Visual StudioProjects\VSWebCache. Unable to create disk-based web at C:\Documents and Settings\TEMP\My Documents\Visual Studio Projects\VSWebCache because its parent web would not be a disk-based web, create the disk-base web elsewhere outside of your servers documnent...
3
8235
by: frenchy | last post by:
I am getting this error in Adobe after struggling with a 'submit' button on an acrobat form that is in production and all the other appdev people in the office are NOT having a problem with. It submits the form to the web successfully for them, for me the button just clicks and does nothing. So we turned on my javascript debug in Adobe and are getting this? Acrobat EScript Built-in Functions Version 6.0 Acrobat Annotations /...
4
5232
by: smoi | last post by:
Hello... I need help with the error I encounter when I tried to open a Table in MS SQL Server. I have the following code in VB6. Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.open "TableName", adoConn, adOpenKeyset, adLockOptimistic where adoConn is my Connection to the Ms SQL Server Database.
1
1773
by: =?Utf-8?B?bWF4ZG9nMzAx?= | last post by:
XP home SP2. when I tried to reload software i am getting a error. went to the registry and tried to remove the key. get the 'error opening key'. most keys open some don't. right clicked went to properties that said i did not have permission tried to change permision would not let me. even tried in safe mode administrator. Same results
4
2066
by: breadhead | last post by:
Good morning, all. I am creating an Access 2002 application to run on XP clients and I'm struggling with the task of testing whether a single-field record exists before allowing the user to add it to a look up table. I considered creating a unique index on the field in the table, but the users here would not know how to handle the error message. From there, I moved to creating a recordset that tests for the presence of a matching record...
1
1910
by: omar.norton | last post by:
I am trying to create a from with a series of combo boxes that each query a different field (called Specific01, Specific02 etc., except the first field which is called Condition). Each combo box has a SQL statement in it's rowsource so it will only display distinct records in it's field where all the previous fields match the choices chosen in previous combo boxes, so eventually your choices will be narrowed down until you come up with a...
7
2484
by: kpfunf | last post by:
Getting the following error opening a report, cannot figure out the cause: "You tried to execute a query that does not include the specified expression 'RQ_FuelQuoteReportHistory.Vendor' as part of an aggregate function" Not sure why this comes up as Vendor is not part of any aggregate function (that I know of!). The query runs fine. The error occurs when opening the report. Vendor is not used in sorting or grouping. I tried deleting the...
2
1968
by: emvy681 | last post by:
I have a problem on programming, i am not that good but i can read and implement some programs. I just wanna ask help on this code Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) Too few parameters. Expected 1. /pang/view_station.asp, line 14 which is "myrec.Open sql"
1
10863
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10422
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9586
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7136
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5807
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6005
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.