Query Result into a TextBox

Diango

Registered User.
Local time
Today, 08:29
Joined
Sep 6, 2007
Messages
19
I'm trying to get the following SQL Query result into a TextBox. This is my Query:

SELECT ID
from tblEmployee
Where DateEntered IN (Select Max(dateEntered) from tblEmployee)

;

I know that to get a single result into a textbox I would normally use DLookup, but I don't think DLOOKUP allows you to have a subquery, if so, how would you set that up.
 
Diango,

There also might be many IDs returned ...

Code:
Dim rst As DAO.Recordset
Dim Temp As String
Temp = ""
Set rst = CurrentDb.OpenRecordset("SELECT ID & _ 
                                  "From tblEmployee " & _
                                  "Where DateEntered IN (Select Max(dateEntered) " & _
                                  "                      from tblEmployee)"
While Not rst.EOF and Not rst.BOF
   Temp = Temp & rst!ID & vbCrLf
   rst.MoveNext
   Wend
Me.YourTextBox = Temp

Wayne
 
Why doesn't this work?

qResult = DLookup("ID", "tblEmployee", "[DateEntered]= 11/8/2007 9:38:53 AM")

That date is the exact value that's in my DateEntered Field(text value field)
 

Users who are viewing this thread

Back
Top Bottom