473,652 Members | 3,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2356
On Mon, 14 Feb 2005 19:39:02 +0000, feck <ne*********@ho tmail.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.OrderDat e 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
1541
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 last 10 pages viewed or the id of the last 10 visitors to a page, but how do I make this "rolling" e.g. a visitor looks at a page, his id is stored in an access 2000 db, another vsitor then looks at the page, his id is also stored, when I get to
2
1762
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 method of dataset). When doing the restore i have to overwrite the data from xml back to database. these are the steps that i follow. 1. get the data from database.
3
1334
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 the last inserted record. It's easy to do Select * from table where field1=x ORDER BY dtModificationTime. That works, but it hits all the records that match the field. I need to come back with an exact hit. Can someone point me in the...
10
17494
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 docmd.gotorecord aclast but i did not
6
2885
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 pick up the first name of Table1 and check that name in that table (Table1) as well as the remaining 99 tables. Continue this till we reach the last name (record) of the 100th table.
2
1204
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
2520
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
1545
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) in that DataTable. I need two fields from that DataTable to compose the key. Example: i'm looking for the record where field 'Codigo' = '000100' and field 'CPostal' = '3000-001'. // Defining fields 'codigo' + 'cpostal' as key fields
1
1220
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 today's date is 4/22/2008 , I want the MeetingDate field to look up the NEXT meeting this month... this would show as 4/23/2008. If today's date is 4/29/2008, then I need the query to find the NEXT meeting date which would be 5/28/2008.
0
8367
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8467
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.