I have a textbox that takes a lot of values. I want when I close the form or the application to save the last value and when I open the form or the application this textbox to show the saved value. Something like a high score in a game. Thank you
Is this text box bound to a field in a table? If that's the case do you want the form to open displaying the record it was displaying when it was closed?
Private Sub Form_Close()
'Set the default value for textbox
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE table SET table.field = [Forms]![FormName]![Textbox] " & vbCrLf & _
"WHERE (((table.ID)=1));"
DoCmd.SetWarnings True
End Sub
Private Sub Form_Load()
'Load the default value for textbox
Me.Textbox.Value = DLookup("[field]", "[table]", "[ID]=1")
End Sub