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 / General 1 / February 2005

Tip: Looking for answers? Try searching our database.

Finding the last record -10

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
feck - 14 Feb 2005 19:39 GMT
I have a database with several tables, one of which is [Master Data
Table]

I use this to bring up a form so you can unlock the record (set by
using a yes no box on the data input form to prevent unauthorised
tweaking once the record is completed).

I would like to move to the last record but 10 to give the form 10
lines of the last entries, rather than one that is achieved by using
goto record.... acLast

I have tried using sql in the form open event such that I can obtain
the total number of records, take away 10 and then use the offset
parameter to move to the required records.  But I cannot either get
the syntax rightusing it as a straight expression in the On Open event
of the record unlock form,   as in:

Dim numofrecords as Long
numofrecords = (SELECT COUNT(*) FROM [Master Data Table])

or alternatively by using a subquery as an expression in the original
query that underlies the record unlock form.  It is probably just a
syntax problem, but I cant find a good resource to give examples of
this usage.  I can see using SQL being quite useful to filter and
obtain relevant data for forms requiring statistical inquiry, but am
jiggered if I know how at this time

Any help gratefully appreciated.

JBN
Tom van Stiphout - 15 Feb 2005 02:28 GMT
Check out the Top predicate. Something like this may work (from the
Northwind sample app):
SELECT TOP 10 Orders.*
FROM Orders
ORDER BY Orders.OrderDate DESC;

Don't forget the Order By clause.

-Tom.

>I have a database with several tables, one of which is [Master Data
>Table]
[quoted text clipped - 26 lines]
>
>JBN
 
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.