Free Code Snippets in C#, Net Framework, Office 365, ASP.Net,WPF, Visual Studio, SQL Server, Antivirus free
#

 

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

 

Task:

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.

 

Solution:

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

 

Example:

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

 

 

 

Mobile
»
Access: Conditional formatting when another number field is empty or zero
»
Access: Conditional formatting Expression for adjacent fields
»
Ms Access: Set default value in vba

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de