User defined value for data entry

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I would like to use a form for data entry in which I would
like to set 5 fields of data with a specific value that I
want repeated for my data entry. Then I only want to have
to input the fields that change (2 fields).

Example:

I want to set these fields at the beginning of data entry:
Ship Date
Carrier
PO Number
Release Number
Due Date

And only have to key these 2 fields to create a record:
Part Number
Qty

Because the first 5 fields will be the same information
every time I do data entry, and will change with each new
shipment, can I set these values once at the beginning and
they will stay set at that value for the rest of my entry?

Currently, I am changing default values in the table for
all 5 of these fields to enable quicker data entry.

Thanks,
Matt
 
Changing the Default Value is a good approach; simply do
it in the AfterUpdate event of the fields you wish to
remain constant. Then, whenever the user changes the
value, it becomes the new default:

' For numeric fields
Sub txtMyTextBox_AfterUpdate()
Me!txtMyTextBox.DefaultValue = Me!txtMyTextBox
End Sub

' For string fields

Me!txtMyTextBox.DefaultValue = """ & Me!txtMyTextBox
& """

HTH
Kevin Sprinkel
 
Or, better still, create a generic function in a global
code module:

Sub UpdateDefaultValue()
' Generic procedure to update default to current value
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Screen.ActiveControl
If IsNumeric(ctlCurrentControl) Then
ctlCurrentControl.DefaultValue = ctlCurrentControl
Else
ctlCurrentControl.DefaultValue = _
& "'" & ctlCurrentControl & "'"
End If
End Sub

And simply call this sub in the AfterUpdate event:

Sub txtYourTextBox_AfterUpdate()
Call UpdateDefaultValue
End Sub

KS
 
Back
Top