Solved

Need RecordSource Guide to loop through records without me.recordsource

Posted on 2009-07-14
5
287 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
Comment Utility
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
Comment Utility
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
Comment Utility
rst!ID
0
 
LVL 1

Author Comment

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

Expert Comment

by:Jeffrey Coachman
Comment Utility
;-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now