MS Access

Copper Contributor

on an input form, how can I keep the previous entry for a field as default for future entries

1 Reply

@jmtreky 

 

One way to do this is entering VBA-code like this in the code module for the input form:

Private Sub Form_AfterUpdate()
  TempVars("CustID") = Me.CustID.Value
  TempVars("OrderType") = Me.OrderType.Value
End Sub

 

Private Sub Form_Current()
  If Me.NewRecord = True Then  

    Me.CustID.Value = TempVars("CustID")
    Me.OrderType.Value = TempVars("OrderType")

  End If

End Sub

 

You can replace and extend the field names to your convenience. 

 

Best wishes,

Tieme