I receive tons of question on how to set a default value on an unbound Auto Complete Box, my initial response to this question is to bound it and equate the data binding to the FirstOrDefault property of a LINQ statement. Because I really don’t know how to do it on an unbound Auto Complete Box except now.
Instead of looking for a property on how to set the default value of an unbound Auto Complete Box, I change the event on which where to equate the default value of the control, it turns out nice and it worked. This is Microsoft Access experience 101.
Normally, all my screen properties, controls and data are set on the Created event. Setting a default value on an unbound Auto Complete box on this event including the Initialize screen event seems to fail but the screen Loaded is a miracle.
In the image below, my unbound Auto Complete Box is the CommissStatus property, by the way, make sure to set the Required property of this control to true.
Once you’ve created the control, insert the sample code snippet below: My screen name is trnUnitSoldCommission, therefore the code snippet below is the screen Loaded event implementation.
Private Sub trnUnitSoldCommission_Loaded(succeeded As Boolean) If Me.CommissionStatus Is Nothing Then Me.CommissionStatus = "REQUESTED" End If End Sub
If you find this blog helpful, you can make the donation by clicking the Paypal button below.