Replacement DFIRST for SQL

  • Thread starter Thread starter John Cosmas
  • Start date Start date
J

John Cosmas

Anyone know how to replace the DFIRST statement in Access to working in/with
SQL. SQL Server does not have an equavalent statement/function.

John Cosmas
 
You could use a subquery:
(SELECT TOP 1 YourField FROM tblYourTable ORDER BY OtherField)
 
Anyone know how to replace the DFIRST statement in Access to working
in/with SQL.

What on earth use is DFirst if you can't specify a sort order? It's not
going to be truly random, and it's not going to be specific either.

Any guesses?

Tim F
 
What on earth use is DFirst if you can't specify a sort order? It's not
going to be truly random, and it's not going to be specific either.

It's only useful if you don't CARE which record you get. This can
happen; a join query might have only one record on the main table for
instance. In practice I rarely use it, and never under any
circumstances use DLast - it has the same problems and requires that
Access populate the entire recordset rather than just pulling the
first record.
 
It's only useful if you don't CARE which record you get. This can
happen; a join query might have only one record on the main table for
instance.

.... so wouldn't that be a normal DLookUp() function?


To be honest, I never even knew the functions existed, and even the help
file admits they return the value from a random record. Inexplicable.

B Wishes


Tim F
 
Back
Top