Remember last entry in form field

AbeA

Registered User.
Local time
Today, 00:29
Joined
Dec 21, 2006
Messages
28
Firstly, thanks everyone for your help.

I have a form that Employees will use to input certain jobs they have done throughout the day (e.g. mowing, raking). One record in the form represents one task that one individual has done. We can get several records from a single employee in a day, because almost all employees have multiple tasks throughout the day.

Basically, I want to know a way to set up my form so that when a User first opens the form, they only have to enter the date of their tasks, name, and employee ID only once. The way it's set up now is they have to enter these three fields in for each NEW task, which can be tedious. How would I go about repairing this?

Thanks!
 
It sounds as if you need a main form and subform with the main form having the employee ID,etc and the subform their tasks.
 
Last edited:
Thanks for the reply. That will work, but the subform looks a little messy (there's another record progress set of buttons at the bottom, scroll bar and whatnot)... isn't there a way to set it up so that when a user inputs all info and goes to the next record to set up the next task, access retains its last inputted data for the ID, name and date fields?

thanks.
 
You could of course copy the relevant information into suitable variables and then when the user enters a new record you write code to put the value of the variables into the relevant fields.
 
Not exactly sure how your users are accessing the database, i.e. each one has their own PC or all sharing one, but here's some code to look at. It looks at the current value entered in a field and makes it the Default Value for the field, so that this value is entered the field when a new record is created. This value will remain in force until it's changed or the form is closed then re-opened. If multiple users are utilizing the same PC, you could only use this for the date field, but in this type of scenario you could possible use a combobox to facilitate entering the employee's name and ID number.

For Text fields

Code:
Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
  YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
End If
End Sub
For Numeric fields

Code:
Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
  YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub

For Date fields

Code:
Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
  YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
End If
End Sub

Linq
 

Users who are viewing this thread

Back
Top Bottom