difference between clicking and calling click event in command button? (1 Viewer)

Rx_

Nothing In Moderation
Local time
Today, 15:02
Joined
Oct 22, 2009
Messages
2,803
A form for a dropdown list box with an add new mode has a "Continue" and "Undo" command button with code.
When using the command buttons, the applications works perfectlly.
The customer doesn't like "accept" or "undo" buttons and wanted a Message Box with a Yes/NO (I know, but it is a culture here).
So, I added a message box:
YES has code to Call Continue_Click and it works like a charm.
NO has code to Call Undo_Click - and it fails.
If I click Undo command button directly, it works, setting the pull down list box back to the orginal value.
But, using the Call method, it runs the code (seen in debugger) but won't reset the pull down list box to its orginal value.
(there are no local variables in the click event)
Have also moved the focus off of the dropdown.
Just wondering why the difference?

There must be some other event going on.

10 If Not IsNull(Me.rsAddNew.Fields(1).Value) Then
20 Me.rsAddNew.Delete
30 Me.rsAddNew.Bookmark = rsAddNewBookmark
40 Else
50 rsAddNew.CancelUpdate ' was still (new) record
70 End If
 

Rx_

Nothing In Moderation
Local time
Today, 15:02
Joined
Oct 22, 2009
Messages
2,803
Observation:
I notice that the form current event runs with the command button, but not when using the Call method for the code.

Copied all the code in the command button into the yes/no message box and see that the form current does not run either.

There is no code in the form current.
 

Users who are viewing this thread

Top Bottom