Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

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]![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.

????
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial