Solved

SELECT LAST problem

Posted on 2011-03-09
6
258 Views
Last Modified: 2013-12-17
(Remark: The question is for experienced experts please do not send googling answers)
I have an mdb table which I check last record by:
"SELECT LAST(user_number) from sw1_users"  
then I Insert a new record  to the table succefully
and check last record again by:
"SELECT LAST(user_number) from sw1_users"
It work fine for a period of time but now I get the same LAST value always.
I tried to delete some last records but it doesent help, it seems that the table is not counting new records.
How can I solve this or check for the source of the problem?
0
Comment
Question by:yaron89
6 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35081651
this seems to be ms access, and not ms sql server, right?
you might want to use MAX() instead of LAST()
0
 
LVL 9

Expert Comment

by:kaminda
ID: 35081756
I am not sure why Access has stopped working abruptly. But without relying on this access function you can write some SQL to get the same out put

SELECT TOP 1 user_number from sw1_users ORDER BY user_number DESC
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35081825
explanation: LAST will return the "last record returned", but the rows might not be returned in the order of that field.
so, only MAX() will be the correct approach.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 35083040
>>Zones: MS SQL Server, Microsoft Visual C#.Net<<
Please request the thread be moved from MS SQL Server to the more appropriate MS Access zone.
0
 

Author Closing Comment

by:yaron89
ID: 35083105
Thank you
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now