Can you boost my understanding of Access? I don't like things I can 'cure' but don't understand why!
I've converted the Save macro on my form to VBA. It looks like this ... as I'm sure you already know.
For some reason, with the code as it stands, you have to click the Save button twice. The first time nothing happens at all (no error message, and the button doesn't do the "I've been clicked" little wobble) and you have to click it again ... then it "wobbles properly" and saves the record. However, if I comment out the line
"On Error Resume Next"
the problem goes away. I've read about Resume Next, and I think I understand it. I can see that if there WAS an error the code would/might behave as I've described(?), but there doesn't seem to be anything wrong. The changes I make to the record could be as little as removing one word from a "Comments" field. Surely there can't be anything wrong, otherwise Save wouldn't work the second time? Baffled (again)
Can you guys explain this?
I've converted the Save macro on my form to VBA. It looks like this ... as I'm sure you already know.
Code:
Private Sub SaveChanges_Click()
On Error GoTo SaveChanges_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
SaveChanges_Click_Exit:
Exit Sub
SaveChanges_Click_Err:
MsgBox Error$
Resume SaveChanges_Click_Exit
End Sub
"On Error Resume Next"
the problem goes away. I've read about Resume Next, and I think I understand it. I can see that if there WAS an error the code would/might behave as I've described(?), but there doesn't seem to be anything wrong. The changes I make to the record could be as little as removing one word from a "Comments" field. Surely there can't be anything wrong, otherwise Save wouldn't work the second time? Baffled (again)
Can you guys explain this?
Comment