Problems With BeforeUpdate

aldo

Registered User.
Local time
Today, 15:56
Joined
Nov 18, 2006
Messages
10
I have the following code entered on a subform:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Verify = -1 And Me.Status = 0 Then
Dim strMsg As String
strMsg = "This account has not been updated." & Chr(10) & Chr(10) & _
"Do you wish to update the account now?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Update Account?") = vbYes Then
Me.Status = -1
Else
End If
End If
End Sub
The code is placed on the subform 'Form_Main' with the intention that if the 'Verify' checkbox is selected the data entry person will receive a reminder that they did not update the current account. The code seemed to work fine, but there are 4 subforms on the 'Form_Main' form and if any of those are selected the code will run inadvertently. Is there anyway to code so that the program only runs the verification process when moving between records on the 'Form_Main' form?

-aldo
 
Last edited:
when you click on the subform, the main form record will try to save - hence you get your message

rather than do your test on the form before update, why not do it on the regverify checkbox afterupdate event - which is probably where it ought to be anyway - do the test as soon as the user clicks the check box

then you won't get the message when you move to a subform
 
The 'Verify' checkbox is selected to place data entry into a verification mode at the beginning of data entry. It is not to be selected for every record entry. It works in the background to remind you that you may have overlooked setting a record to 'Updated'.

There are essentially two modes of data entry on the database. Previous and New accounts are entered in separate sessions under different modes. Both are entered from update sheets.

1) New entries. New entries are entered with the 'Verification' mode turned off. As soon as a new record is initiated the 'account' is automatically updated, 'Status' set to -1.

2) Previous entries. Previous entries are pulled up and data is verified against returned update sheets. New phone numbers and addresses are all updated. If all the information on an account record is correct the data entry person makes no updates on the record, but merely selects the 'Status' checkbox which sets the value to -1.

Because this can be a very quick and simple process when data has not changed, sometimes the data entry person neglects to select the 'Status' checkbox before moving on to the next record. This could be due to oversight or just a misclick.

Anyone have any ideas how I can get the above code in the OP to work or have another idea that might work.

-aldo
 
Last edited:
You could move the code to a button called save record and do the test there just use the oncurrent to create a stat if the use adds a new record then update the stat so you know you need to check the record before they can move away from the record.

use cancel = True in the Before Update testing the State.

Once they click save the stat can be set to OK To Move IE Stat = True maybe.

hope it helps

mick

p.s use ondirty to check for user entry set you stat = false then
 
Last edited:
I've decided to replace the navigation buttons and add the code via click events.

This seems to be working, but I am having trouble getting the buttons to behave like the normal navigation buttons. I need to disable the 'GoToNextRecord' button when I reach the last record.

And how do you get the record number to display in the text box between the navigation buttons?

Also it would be nice to enter a record number into the text box and have it bring up the record.

-aldo
 
Last edited:

Users who are viewing this thread

Back
Top Bottom