Looking for advise on how to overwrite a default value
Posted on 2014-01-16
On a form I have a field named "txtGrowDaysEarly". The form is bound to a table named tblPlantings
The field gets a value when the form opens from an onopen event with:
Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", "PlantedID = " & [Forms]![frmPlanted]![txtPlantedID])
But I want to be able to overwrite the value (which is a number) if I want to do so and have that value written to the field named GrowDaysEarly in the table tblPlantings.
But every time the form opens of course it gets the value again from tblCatalog.
I tried NOT putting the code in the onopen event and instead have it in the default value of the field property but when the form opens it doesn't populate that default value.
Here is the code I have in the default value:
=DLookUp("GrowDaysEarly","tblCatalog","Mnumber = [txtMnumber]")
Mnumber is a number field and is the key field on tblCatalog.