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!

Display entry of last record added in a field from a different table 1

Status
Not open for further replies.

Aspen77

Technical User
Sep 20, 2012
41
US
Hello,

I am using the template Students DB provided by Microsoft. On the Form Student details, I would like to display a status field from another table. It seems that the form is bound to a query with one table, but when I add the second table to the query it creates many problems. Is it possible to display the field from the Student Attendance table without a query or relationship between the two different tables? This field is not for entry just display of status for the record being modified. Thank you!
 
Thank you, I tried Nz([Forms]![Student Details]![ID],0) and I am still receiving the #error. When I try it without the dmax function it works. Do I also need to place the nz somewhere in the dmax function.

Also in the code:
=DLookUp("[Admittance Status]","Guest Admittance Status","[Guest]= " & [Forms]![Student Details]![ID] & " AND [Date Restricted]= #" & DMax("[Date Restricted]","[Guest Admittance Status]","[Guest]=" & [Forms]![Student Details]![ID]) & "#")

What does "#" mean in the code above?

Thank you!
 
=DLookUp("[Admittance Status]","Guest Admittance Status","[Guest]=" & Nz([Forms]![Student Details]![ID],0) & " AND [Date Restricted]=#" & [!]Nz([/!]DMax("[Date Restricted]","[Guest Admittance Status]","[Guest]=" & Nz([Forms]![Student Details]![ID],0))[!],#1901-01-01#)[/!] & "#")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
The following code worked:
=DLookUp("[Admittance Status]","Guest Admittance Status","[Guest]=" & Nz([Forms]![Student Details]![ID],0) & " AND [Date Restricted]=#" & Nz(DMax("[Date Restricted]","[Guest Admittance Status]","[Guest]=" & Nz([Forms]![Student Details]![ID],0)),#1901-01-01#) & "#")

Great job! Thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top