Set default value of Combo box using displayed combo box value
Posted on 2014-01-29
I am attempting to allow a user to reset the default value of a combo box based on its displayed value. I have 4 combo boxes of differing types to do this with (one integer, 3 text). For example, I want the user to be able to reset a default year on their own, and a combo box with available years is already displayed. Functionally, I want the user to select a year, push a "set to default" button which will then reset that users default value to the displayed value. Each user has their own "front-end" copy of access (everything except tables - which are linked), so this should be easy but I'm stumped. Here is what I attached to the "set to default" button:
Private Sub set_default_yr_Click()
Dim reset_yr As Integer
reset_yr = Me.CurYear.Value
Me.CurYear.DefaultValue = reset_yr
Oddly, my immediate window shows a null value for reset_yr after I push the set to default button. Thanks for your help!