473,385 Members | 1,347 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,385 software developers and data experts.

ADODB.RecordSet is not returning query results in MS Access 365 but same query does i

I am using the following code. The problem is that the rst.recordcount is showing -1. When I take that same query in Access. it brings back two rows. I have MS Access 365 front end and SQL 2017 backend.

The current.connection beginning shows:
Expand|Select|Wrap|Line Numbers
  1. Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;
I am befuddled as to why this is not working.

Thanks for any insights
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String, strSQLWHERE As String
  2.     Dim rst As ADODB.Recordset
  3.     Dim strFolderPath As String
  4.  
  5.     Set rst = New ADODB.Recordset
  6.  
  7.     strSQL = "SELECT tblHyperlinks.* FROM tblHyperlinks WHERE Doc_Version_ID = " & Me!Doc_Version_ID
  8.  
  9.  rst.Open strSQL, CurrentProject.Connection
  10.  
  11.  If rst.RecordCount <= 0 Then
  12.  
  13. ELSE
  14. '' Need to be here
  15. End IF
Jan 22 '20 #1
3 1511
NeoPa
32,556 Expert Mod 16PB
Hi Jac.

Welcome to Bytes.com.

I suspect this is because a Recordset will typically not know the full count until it has processed through getting all the records into its local buffer. Until it knows what the count is it returns -1.
Jan 22 '20 #2
Thanks, NeoPa. I tried inserting a rst.movelast command before the record count and go the error message Run-Time Error '3021;

Either BOF or EOF is True or the current record has been deleted. Requested operation requires a current record.
Jan 23 '20 #3
NeoPa
32,556 Expert Mod 16PB
I'm sorry. I don't have a lot of experience using ADODB, and no time now to gain it or look into it more deeply.

Is there any reason why you're using ADODB for an ACE table? Seems a little counter-intuitive to me if I'm honest.

If using the more native DAO doesn't appeal to you then I would suggest reading all the notes from the ADODB.Open() help page and considering what may be the cause of the behaviour.
Jan 24 '20 #4

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

Similar topics

3
by: ching | last post by:
Hi I've seen many posting in the web on the similar problem I encountered below, but I still couldn't find any solution to it. I built an ASP.NET application, which is migrated from ASP. the...
3
by: XavierX | last post by:
Hi, I am trying to create a web page that outputs a list of data from a join on 2 tables. The Tables: PANEL - A list of possible panel numbers PANELID - Primary key, EVENTS - List of...
8
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 ,...
3
by: DaMiWa | last post by:
I have a a query "Structure ID" set up where Access asks the user to enter the structure ID. Is there a way to return the results of the query into an already made form? Thank you.
1
by: thepresidentis | last post by:
here is my problem, i have a website that compiles concert listings for users to search for shows in their local area, i ran into a problem with returning search results due to an improper format...
10
klarae99
by: klarae99 | last post by:
I am working on an Inventory Database in Access 2003. I am having trouble with a report I designed to show current inventory in stock. I have a form (frmInventory) that is unbound. There are four...
9
by: anthony | last post by:
In Access 2007, why does a query field designed as Term: ! ! return 00:00:00 when cboTerm actually contains 08SP. This works as expected in Access 2003?
3
by: zahmbonnie | last post by:
I have created two different queries and I would like take the results from one and subtract the results from the other. I can not figure out how to write the saved query name in my new query. Saved...
5
by: vishal prada | last post by:
ResultSet res = st.executeQuery("select * from regist where Password='"+User_Password+"'"); if(res.next()==true) { ps = con.prepareStatement("update regist set Password=?,...
4
by: Neruda | last post by:
Hi, first select query returns always 1 record (8 fields) The second (crosstab) returns 1 row (6 fields) both query work fine on their own. Can I create 1 query to return 14 fields on 1 row? How...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.