Cancelled the Previous Operation

G

Guest

I receive the error message "You cancelled the Previous Operation". Most
times the code works but it's still frustrating for my users. Can you tell me
what i'm doing wrong?

Any assistance is greatly appreciated.

Description:
The user selects a record from a listbox.
Clicks an "open" button.
Form called TCA is opened to record to corresponds to the item selected in
the listbox.

Code:

Private Sub New_OpenTCA_Click()
On Error GoTo Err_New_OpenTCA_Click

Dim stDocName As String
Dim stLinkCriteria As String

' user selects a record from a listbox (notify if no record selected)
If Me.New_TCAUnit <> "" And IsNull(New_TCAUnit) = False Then
stDocName = "TCA"
stLinkCriteria = "[TCANo]=" & Me![New_TCAUnit]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

' disallow scrolling of records
Form_TCA.AllowAdditions = False

Else 'no tca selected
MsgBox ("Please select a TCA to view before continuing.")
End If
' ensure that continue with sale button is visible
Form_TCA.ContinueWSale.Visible = True
Exit_New_OpenTCA_Click:
Exit Sub

Err_New_OpenTCA_Click:
MsgBox Err.Description
Resume Exit_New_OpenTCA_Click

End Sub

Thanks in advance,

Pip''n
 
R

Ron2006

Typically I get that type of inane message when a query that is
involved in the operations that I am perform fails.

Usually I have to
1) make sure that setwarnings is true
2) bring up the form/forms necessary for everything to run and have
data in all of the required fields.
3) step through the queries involved in the process manually.

Ususally I then come up with a meaning full error message.

Ron

(An alternative may be to add the setwarnings to true in the process
and/or comment out where it is being set to false in the processes that
are being run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top