Data input form memory of previous entry for some fields (1 Viewer)

dlambert

Member
Local time
Today, 05:59
Joined
Apr 16, 2020
Messages
42
Hello All,
I am trying to get the following to work:
Data input form with the following fields:
1 - CustomerName (combobox from a table)
2 - JobNumber (combobox from a query)
3 - Employee (combobox from a query)
4 - WorkDate
5 - WorkDescription
6 - WorkHours
All the above data is to go into a table called tblWorkHoursInput with corresponding columns
When the data is being entered, most of the time fields 1,2,3,4 will stay the same for multiple entries (with variations in fields 5 and 6).
What I would ideally like to achieve is a way that i can fill all the fields then press a button that would add the corresponding record, and automatically clear fields 5 and 6 so the new data can be inputted before pressing the same button again to add another record. In between entries i could change any of the fields 1,2,3,4 as required and it would then be remembered for the next record.
Any suggestions on the best to go to achieve this?
Any help if much appreciated.
 

Ranman256

Well-known member
Local time
Today, 00:59
Joined
Apr 9, 2015
Messages
4,339
I store the data in the control.tag.
tag property is the 'free parking' for anything.

'save values
txtCustName.tag = txtCustName
txtJobNum.tag =txtJobNum
etc...

then new record, load them back:
txtCustName= txtCustName.tag
txtJobNum=txtJobNum.tag
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:59
Joined
Sep 21, 2011
Messages
14,048
I used this method

Code:
Private Sub Date_ID_AfterUpdate()
    If Me.chkCopy Then
        Me![Date_ID].DefaultValue = """" & Me![Date_ID].Value & """"
    Else
        Me![Date_ID].DefaultValue = 0
    End If
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:59
Joined
May 7, 2009
Messages
19,169
or you can use the Form's BeforeUpdate event to set the DefaultValues of the controls.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:59
Joined
Oct 29, 2018
Messages
21,358
Hi. If data in 1 to 4 repeat, then perhaps they belong in a parent table?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:59
Joined
May 7, 2009
Messages
19,169
parent query if they can be joined.
 

Users who are viewing this thread

Top Bottom