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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value for field 1

Status
Not open for further replies.

liamm

Technical User
Aug 12, 2002
102
GB
Hi,
I am trying to set the default value for a form field to the last value entered in that field. For example if somebody uses the form today and enters ABCD then when a new user opens the form tomorrow the field will automatically have ABCD inserted.
I have tried using the following code in expression builder

=DLookUp("[016]","[TblEvents]","[ID] =form![ID]")

My table name is TblEvents
The field name is 016

If I change the code to
=DLookUp("[016]","[TblEvents]","[ID]=1")
this sets the default value to that entered where the form ID is 1.
What I really need is instead of ID being 1, for it to be new form ID minus 1.
Hope this makes sense.
Should I try to do this another way?
Liam

If you can help, GREAT
If I can help, EVEN BETTER
 
Try this...

=DLookUp("[016]","[TblEvents]","[ID] = " & form![ID])



Randy
 
Something like this (typed not tested)
=DLookUp("[016]","[TblEvents]","[ID]=Max(ID)")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks guys but,
neither of the above methods worked. An #error was returned in the field.
Liam

If you can help, GREAT
If I can help, EVEN BETTER
 
And this ?
=DLookUp("[016]","TblEvents","ID=" & DMax(ID,"TblEvents"))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV,
this works great. You guys are great thnks for the help. Cheers Randy700 for contributing also

Liam

If you can help, GREAT
If I can help, EVEN BETTER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top