Not gonna work, I want to put a default value, not an actual value, cos otherwise the record will be added to the database, which I don't want to.
I wrote some VB and in the default value box, called this function. seems to work.
This is what I did, I created this function in a module, and in the defaultvalue prop in Access, I called this function ( = default_jaar() )
Public Function default_jaar() As Integer
If Month(Date) > 4 Then
default_jaar = DLookup("cohort_id", "TBL_cohorten", "startjaar =" & Year(Date))
default_jaar = DLookup("cohort_id", "TBL_cohorten", "startjaar =" & Year(Date) - 1)
The difference in your approach is that when I follow your code, I actually put a value in the combobox. If I want to cancel the add new record, I already have created a new record (I work with pop-up forms). So when I folow your code, a new id is given to the record, this is something I don't want, hence this solution.