Solved

Need RecordSource Guide to loop through records without me.recordsource

Posted on 2009-07-14
5
292 Views
Last Modified: 2013-11-27
I need a general how-to on creating and using a new recordsource... one other than the me.recordsource... to loop through records in a table.

I need to run through this recordsource in a public function that will be used within the looping through a me.recordsource.
0
Comment
Question by:travisjbennett
  • 3
  • 2
5 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 24853254
You did not explain what you ultimate goal is here, so I will present a generic example.
On your form put a button to run code like this:

'
Dim rst as DAO.Recordset
Set rst=CurrentDB.Openrecordset("YourTableName")

    rst.movefirst
   
    Do Until rst.eof
        'Do Something
        rst.movenext
    Loop
   
msgbox "Done"

rst.Close
Set rst=Nothing
'

JeffCoachman
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 24853564
So how do I refer to a field in that recordset?
When I try to use [ID] it says Run-time error '2465': (Databasename) can't find the field 'ID' reffered to in your expression.
When I try to use YourTableName.[ID] it says Run-time error '424': Object required.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 500 total points
ID: 24853901
rst!ID
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 24854174
Beautiful. Works with the bang, but not the dot.
Thanks boaq!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24855318
;-)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

856 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