472,959 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,959 software developers and data experts.

Finding the last record -10

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
Nov 13 '05 #1
1 2311
On Mon, 14 Feb 2005 19:39:02 +0000, feck <ne*********@hotmail.com>
wrote:

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]

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


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alistair | last post by:
hi peoples and masterful gurus (a little bit of grovelling never hurt anyone...apart from the sore knees) I'm after a little bit of advice on how to do something. basically a history of the...
2
by: Devesh Aggarwal | last post by:
Hi, I have a backup and restore module in my project. The backup uses a typed dataset object (XSD) to get the data from database and creates a xml file as the backup file (using the WriteXml...
3
by: JohnnyRuin | last post by:
Hi, My table has int Field1 and DateTime dtModificationTime. I maintain a history of changes to the table by inserting a new record with a new dtModificationTime. I need to be able to find...
10
by: Alain Guichaoua | last post by:
Good evening to all Here is my problem : I have a form with a subform. They are linked. When I open the form I would like the subform to reach its last record. I tried the method...
6
by: Maxi | last post by:
I have 100 tabes in an Access database, every table has 1 filed with 100 names (records), no primary key assigned. I would like to find duplicates. Here is the criteria: The computer should...
2
by: Mark Vergara | last post by:
Hi! Is there any way of finding of what position in a particular record ? For example I have 3 records 1 Record 1.. 2 Record 2.. 3 Record 3..
17
by: michel.ank | last post by:
Hi, I'm using the class PrintLines and my last record of page aren't with the borders. Somebody can help me? Thanks,
1
by: JoaquimC | last post by:
Hello, I'm new to C#, and i need help with the following problem: I have a DataTable called 'Nomes', part of a DataSet with various datatables. I am searching a record (that i know it exists)...
1
by: Presto | last post by:
I have two date fields. PaymentDate - is set to default to today : =Date() MeetingDate - is going to find the next meeting date after the PaymentDate So using April as an example: If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.