Default values equalling the last record in a different table.

E.Ed.Lohamr

New member
Local time
Today, 11:22
Joined
Feb 7, 2013
Messages
4
Yo,

I'm looking for a way to set the default value of a field in a form to be the last record in a table other than the table in which the form will be inputting data. I've seen code like this used:

Me.InputText.DefaultValue = "'" & Me.InputText & "'"

in the After Update event in order to set a default value as the last record in the same form, but this isn't what I want. I want the default value to come from the last record of another table. This way it will change if I put a new record in the other table, but will remain the same if I enter multiple records through form.

I am using Access 2010 and have a somewhat limited knowledge of it.
 
Since I didn't know how to do it, I haven't yet. So, as of now, they don't exist. I've learned it's generally easier to build things how you want them then it is to change them later.
 
you could try

Me.InputText.DefaultValue = DLookUp()
 
nvm. I'm suddenly realizing the importance of subforms... The tables will be related one-to-many once i create them and that was pretty much the first thing that was said in a subform tutorial video i just watched...
 
are you wanting to have a field in your child table to be the unique id of one of your records in the parent table. preferably the last?
 
i have been given a sample of a one to many table system. ive uploaded it for you
 

Attachments

Users who are viewing this thread

Back
Top Bottom