Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2007

Tip: Looking for answers? Try searching our database.

movefirst returns last recordset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
http - 02 Mar 2007 20:53 GMT
The following code returns not the first, but the last record:

Set db = CurrentDb()
Set tblspec = db.OpenRecordset("tblPIDspec")
tblspec.MoveFirst
MsgBox tblspec("ID")

The MsgBox shows "10" because the Table includes 10 records.
How ist this possible?

thx.
Thomas
Jason Lepack - 02 Mar 2007 21:24 GMT
When you use a table as a recordset it is ordered by it's placement on
the hard-disk.  It will be ordered based on whatever order it went
into the table.  If you want it to be ordered by ID then set your
recordset to this:

Set tblspec = db.OpenRecordset("SELECT * FROM tblPIDspec ORDER BY ID")

> The following code returns not the first, but the last record:
>
[quoted text clipped - 8 lines]
> thx.
> Thomas
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.