Issue with Requery and Save code

Stephd8459

Registered User.
Local time
Yesterday, 16:25
Joined
Jun 29, 2010
Messages
31
Hi,

So I'm trying to work out some issues in my db related to using the example that GHudson posted here:
http://www.access-programmers.co.uk/forums/showthread.php?t=38364&highlight=Mouse

I have two fields on my form that use a DLookup to retrieve a calculated value from a query. When I use the SAVE/UNDO/CLOSE code it causes the users to have to respond to the SAVE for each of the fields involved with the calculation (there are 12 fields that fed into the query calc)

I'm trying to work the code to not request a save for the requery and refresh that are associated with these fields anyone have a thought?

Thanks
Steph
 
No one has any suggestion.

The code is set up to keep a user from ebing able to exit a form that they have made entries on without undo the entries or saving them... but I have several fields that when new data is entered they refresh or requery the form (depends on the field which happens) and when the refresh or requeery occurs the before update code creates the msg to save or undo...
I have been trying to find a way to have the fields that are requery or refresh be exempt from the before update code portion, but have had no luck.
I'd appreciate any thoughts on this, i've run out of ideas

Stephanie
 
Calculated fields are usually unbound fields the only reason you would be asked for confirmation is when the resulting value is bound to a field in a table. Check your forms controls. You do not need to store calculations in tables.
 
DCrake,
I'm not sure I understand what you mean by check your form controls?

and, correct my fields in the form are not bound to a calced field on a table... they are a DLookup of a calced field on a query, so when the data on the form is changed I need the Query to rerun to update the field value.
This is running into the code for Beforeupdate of the form that is in place to keep a user from exiting the form without saving
Code:
'Save-Undo-Close
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
 
    Me.tbHidden.SetFocus
 
    If Me.tbProperSave.Value = "No" Then
        MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance to another record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
       DoCmd.CancelEvent
        Exit Sub
    End If
Exit_Form_BeforeUpdate:
   Exit Sub
Err_Form_BeforeUpdate:
    If Err = 3020 Then  'Update or CancelUpdate without AddNew or Edit
        Exit Sub
    Else
       MsgBox Err.Number, Err.Description
       Resume Exit_Form_BeforeUpdate
    End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom