Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need RecordSource Guide to loop through records without me.recordsource

Posted on 2009-07-14
5
Medium Priority
?
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

636 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