UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Error Code 3059    
 
   
jokeme71
post Jun 8 2006, 02:36 PM
Post#1



Posts: 920
Joined: 7-June 02
From: Maryland


I have a combo box that runs a SQL statement when a certain value is selected. The code executes perfectly but when the users click cancel to end the SQL statement they get error code 3059 which says the operation was canceled by the user. How do I prevent this message from appearing as I do not want the user to have the ability to debug the code.
I have tried using error trapping but it did not work. Here is the code.
Private Sub cboDisp_Change()
On Error GoTo errcboDispChange
Dim stFindVenAcctID As String
Dim stNewESN As String
Dim stAddNewESN As String
stMsg1 = "The disposition was removed from the current record because the end user did not " & _
"enter a valid ESN value."

Select Case Me.cboDisp.Value

Case "Transfer"

stFindVenAcctID = DLookup("[VenAcctID]", "tblCellTNList", "[CellTN] = " & _
"[Forms]![frmCellTNHistLog]![frmCellTNHistLogSubForm]![CellTN]" & _
" AND [AcctTransfer] = 0")

stNewESN = InputBox("Please enter the new electronic serial number (ESN) for " & _
"this cellular telephone number.", " Enter New ESN")

stAddNewESN = "INSERT INTO tblCellTNSupDataHistLog " & _
"([VenAcctID], [CellTN], [ESN], [VenIssDate], [RecImpDate], " & _
"[Comments])" & _
"SELECT '" & stFindVenAcctID & "', [Forms]![frmCellTNHistLog]!" & _
"[frmCellTNHistLogSubForm]![CellTN], '" & stNewESN & "', " & _
"Date(), Date(), " & _
"'Transfer. See Cell TN History Log for further details.'"

If IsNull(stNewESN) Or Len(stNewESN) < 7 Then
MsgBox stMsg1, vbInformation
Me.cboDisp.Value = ""

Else
DoCmd.RunSQL stAddNewESN

End If

Case IsNull(Me.cboDisp)

Case Else

End Select

errcboDispChange:
Select Case Err.Number

Case 0
Exit Sub
Case 3059
MsgBox "Import was canceled by the end user.", vbInformation
Me.cboDisp.Value = ""
Case Else
MsgBox "Error No. " & Err.Number & ": " & Err.Description, vbInformation
Exit Sub
End Select
End Sub
Go to the top of the page
 
 
Start new topic
Replies
strive4peace
post Jun 8 2006, 10:12 PM
Post#2


strive4peace
Posts: 20,385
Joined: 10-January 04



instead of
oCmd.RunSQL stAddNewESN
do this:
CODE

   if msgbox("Do you want to add a new ESN?", vbyesno+vbdefaultbutton2,"Add ESN?") = vbno then exit sub
   currentdb.execute stAddNewESN
Go to the top of the page
 

Posts in this topic
- jokeme71   Error Code 3059   Jun 8 2006, 02:36 PM
- - strive4peace2010   Re: Error Code 3059   Jun 8 2006, 10:12 PM
- - jokeme71   Re: Error Code 3059   Jun 9 2006, 10:32 AM
- - strive4peace2010   Re: Currentdb.Execute instead of DoCmd.RunSQL   Jun 9 2006, 01:48 PM
- - RenaG   Hi Crystal, Thank you for this useful post! I...   Nov 17 2011, 12:23 PM
- - strive4peace2011   Hi Rena, ou're welcome and thank you < > ...   Nov 21 2011, 02:20 PM



Custom Search


RSSSearch   Top   Lo-Fi    17th January 2019 - 04:48 PM