Field Doesn't Save to Table

brsawvel

Registered User.
Local time
Today, 15:45
Joined
Sep 19, 2007
Messages
256
I have an On Open event for my form that says Me.fldX DMAX("[fldX]", "tblX") + 1.

fldX appears fine (it adds one to the highest number in that column and places the result into fldX), but when I enter values in the remaining fields and close the form, fldX show a value of 0 in tblX.

Any idea what I'm doing wrong? I'm doing it this way, because I want to add another button later on that gives the user the option of keeping fldX value the same rather than doing +1 again.
 
Is the textbox bound to the field in the table (the control source property)?
 
The question is whether [fldX] is bound properly. Also, are you saying that the contents of the property slot for the OnOpen event contains a formula?

Also, this is a very narrowly directed fine point, but I don't recall that all of the fields are available on the OnOpen event. Some things (if they are bound) are not available until the OnLoad event which immediately follows the OnOpen event, because the recordset might not yet be open.

I can imagine a mechanism to explain this situation by saying that the field MIGHT be updated by your formula in OnOpen, but then might get overwritten by OnLoad or OnCurrent, both of which fire after OnOpen.

The question is not the value of [fldX] after OnOpen fires but rather, what is its value before the BeforeUpdate fires. Have you tested that?
 
Thank you Gents! Apologies it took me a bit to respond, but I finally got back to working the DB and your recommendations worked.
 
Glad you got it working.
 

Users who are viewing this thread

Back
Top Bottom