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

dlambert

Member
Local time
Today, 14:00
Joined
Apr 16, 2020
Messages
37
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, 08:00
Joined
Apr 9, 2015
Messages
3,889
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, 13:00
Joined
Sep 21, 2011
Messages
8,493
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

once i caught a fish alive...
Local time
Today, 20:00
Joined
May 7, 2009
Messages
13,202
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
Today, 05:00
Joined
Oct 29, 2018
Messages
15,542
Hi. If data in 1 to 4 repeat, then perhaps they belong in a parent table?
 

arnelgp

once i caught a fish alive...
Local time
Today, 20:00
Joined
May 7, 2009
Messages
13,202
parent query if they can be joined.
 

Users who are viewing this thread

Top Bottom