How to set the default value for a field in Access with Vba Basic?



if you enter a value in a field, then automatically after the input the new default value for the column should correspond to the new value.



Under the control element property: Defaultvalue you can set the new default value.

It should be noted that before and after the new default value must be an apostrophe



control.DefaultValue = "'test'"


If you want to include a variable in the default, then you have to link this with merchant-and.

Example of a variable as a default value.

Private Sub ctlSchot_AfterUpdate()

    ctlSchot.DefaultValue = "'" & ctlSchot & "'"

End Sub



Ms Access: Set default value in vba


Software Entwicklung Stuttgart NĂ¼rtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel