Display the very last record created

WinDancer

Registered User.
Local time
Today, 12:17
Joined
Oct 29, 2004
Messages
290
I need to open a form and display the last record created.

I tried this:
DoCmd.OpenForm "frmLocalRecords", , , "TrackingNumber=max()"

but all it does is crash the application...

any help, please?
Thanks,
Dave
 
I didn't check the syntax of your whole statement but I'm immediately drawn to the "=max()"

Have you considered using DMax()? If you do that, you should look up the syntax in help. Also, be cautious about where you put calls to functions. Check out the help syntax for OpenForm and I think you'll find you need to put the =DMax(stuff in here) outside of the quotation marks.
 
Yep, it would. You would have to do something liike this:

Code:
lngTN As Long
lngTN = DMax("TrackingNumber", "YourTableNameHere")

DoCmd.OpenForm "frmLocalRecords", , , "TrackingNumber = " & lngTN
 

Users who are viewing this thread

Back
Top Bottom