473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2335
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.