Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL result from table to textbox - simple but need help.

Status
Not open for further replies.

dssjon

MIS
May 29, 2007
37
US
Hello there,

I'm using
Code:
 =DLookUp("[Username]&'on '&[Date]","Lastrun")
as the parameter for control source in a textbox to display a username and date on a form. The username and date is located in a log table named lastrun. Dlookup is returning the first record from the table but what I need is the newest value in the table, which is the last record of the table. Can anyone out there give me some advice? Thanks!
 
Perhaps this ?
=DLast("[Username]& ' on '& [Date]", "Lastrun")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Specify the following query and save it:

SELECT Lastrun.Username, LastRun.Date FROM Lastrun ORDER BY LastRun.Date Desc;

then use DFirst on this query instead of the table:

=DFirst("[Username] & ' on ' & [Date]","NewQuery")

perhaps, alternatively use DAO :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top