MS Access

%3CLINGO-SUB%20id%3D%22lingo-sub-1182042%22%20slang%3D%22en-US%22%3EMS%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1182042%22%20slang%3D%22en-US%22%3E%3CP%3Eon%20an%20input%20form%2C%20how%20can%20I%20keep%20the%20previous%20entry%20for%20a%20field%20as%20default%20for%20future%20entries%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1182042%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1678791%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1678791%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F563170%22%20target%3D%22_blank%22%3E%40jmtreky%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20way%20to%20do%20this%20is%20entering%20VBA-code%20like%20this%20in%20the%20code%20module%20for%20the%20input%20form%3A%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3EPrivate%20Sub%20Form_AfterUpdate()%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3E%26nbsp%3B%20TempVars(%22CustID%22)%20%3D%20Me.CustID.Value%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3E%26nbsp%3B%20TempVars(%22OrderType%22)%20%3D%20Me.OrderType.Value%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3EEnd%20Sub%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3EPrivate%20Sub%20Form_Current()%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3E%26nbsp%3B%20If%20Me.NewRecord%20%3D%20True%20Then%3C%2FFONT%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%3CFONT%20size%3D%222%22%3EMe.CustID.Value%20%3D%20TempVars(%22CustID%22)%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%3E%26nbsp%3B%20%26nbsp%3B%20Me.OrderType.Value%20%3D%20TempVars(%22OrderType%22)%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3E%26nbsp%3B%20End%20If%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3EEnd%20Sub%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20replace%20and%20extend%20the%20field%20names%20to%20your%20convenience.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20wishes%2C%3C%2FP%3E%3CP%3ETieme%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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