SteveL13
asked on
Looking for advise on how to overwrite a default value
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]![txtP lantedID])
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.
????
The field gets a value when the form opens from an onopen event with:
Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", "PlantedID = " & [Forms]![frmPlanted]![txtP
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","
Mnumber is a number field and is the key field on tblCatalog.
????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.