Forum Discussion

jmtreky's avatar
jmtreky
Copper Contributor
Feb 19, 2020

MS Access

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

  • Woldman's avatar
    Woldman
    Iron Contributor

    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

Share

Resources