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

Recordset for Reports

52
Hi

I'm trying to setup a simple recordset to capture information in a table to place it in a report. Here's the code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Load()
  2.  
  3.     Dim rsOne As Recordset
  4.     Dim SQL As String
  5.  
  6.     SQL = "SELECT * FROM tblTest ;"
  7.  
  8.     Set rsOne = CurrentDb.OpenRecordset(SQL)
  9.  
  10.     Debug.Print (rsOne.RecordCount)
  11.  
  12. End Sub
I know that tblTest has 2 record in it. the debug.print only returns 1 record.

I want to use unbound text boxes on the report and I want to populate the boxes via VBA, the main reason for VBA is I am most comfortable with VBA.

I haven't really tried this before so I'm happy to believe that I'm making some fundamental error in my logic.

Using Access 2007, on xp.
Mar 25 '09 #1
3 1399
ChipR
1,287 Expert 1GB
I think to get the true RecordCount, insert in line 9:
Expand|Select|Wrap|Line Numbers
  1.   rsOne.MoveLast
Mar 25 '09 #2
ChipR
1,287 Expert 1GB
Yeah, just for reference: Recordset.RecordCount Property

"The RecordCount property doesn't indicate how many records are contained in a dynaset–, snapshot–, or forward–only–type Recordset object until all records have been accessed. Once the last record has been accessed, the RecordCount property indicates the total number of undeleted records in the Recordset or TableDef object."
Mar 25 '09 #3
Chinde
52
ha I feel so stupid.

Thanks
Mar 25 '09 #4

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

Similar topics

1
by: Robin Hammond | last post by:
Can anybody tell me why a) when running a stored proc from an asp page to return a recordset the command succeeds if the sp queries an existing table directly, but b) if the stored proc populates...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
0
by: Kevin R | last post by:
Question: I have a situation where I would like to prepare a Recordset object within Visual Basic (6.0), and then use the MS Access COM API's to Show a report built off of the data in my...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
8
by: lauren quantrell | last post by:
When I open an Access form I can have no recordset specified, then in the form's OnOpen event I can do something like: Me.paramaters = "@SomeColumn = 22)" Me.recordsource = "dbo.sproc123" But I...
2
by: Zlatko Matiæ | last post by:
Is there any way to assign recordset to report directly from VBA without usin Record Source property ? I tried to do it in the same way as I do for forms (Me.recordset=rs), but without success......
2
by: KashMarsh | last post by:
Access 2003 I need to have a user filter records on a linked, continuous form and then I want to run various reports/queries from this recordset the user created. I only need to see the PK...
6
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I...
3
by: Gord | last post by:
Me again, I'm new to Access and am self teaching from a couple of books, so bear with me. (I've got a little experience with Visual Basic) As I understand so far, if I want to perform a bunch...
9
by: Chinde | last post by:
I've googled this and I've come up with nothing. I'm using the code below to produce a recordset for a report. all seems to work just fine except when i try to print I get the error: "A custom...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.