P
PJFry
Below is a piece of code I am working on. The issue I am having is that if
there is a recordset error, specifically if the the value in iBox does not
exist in the recordset, there is your standard 'Not BOF or EOF' error. If
that error exists, I will have a msgbox popup stating that; however, if there
is any other error, I want the gcfHandleErrors sub to run.
How can I do that?
Private Sub btnSelectCd_Click()
If gcfHandlErrors Then On Error GoTo PROC_ERR
Dim iBox As String
iBox = InputBox("Please enter retreat code", "Retreat Code")
'Creates recordset as rs
Set rs = New ADODB.Recordset
Set cn = CurrentProject.Connection
'SQL for rs
strSQL = "SELECT * FROM tRetreat WHERE txtRetreatCd = '" & iBox & "'"
'open rs
rs.Open strSQL, cn
retSelect = rs!RetreatID
rs.Close
Set rs = Nothing
DoCmd.OpenForm "fSwitchboard", acNormal
DoCmd.Close acForm, "Form1"
'Error
Handler--------------------------------------------------------------------------------
Exit_PROC_ERR:
Exit Sub
PROC_ERR:
Call ErrorLog("", Module, Err.Number, Err.Description)
End Sub
Thanks in advance!
PJ
there is a recordset error, specifically if the the value in iBox does not
exist in the recordset, there is your standard 'Not BOF or EOF' error. If
that error exists, I will have a msgbox popup stating that; however, if there
is any other error, I want the gcfHandleErrors sub to run.
How can I do that?
Private Sub btnSelectCd_Click()
If gcfHandlErrors Then On Error GoTo PROC_ERR
Dim iBox As String
iBox = InputBox("Please enter retreat code", "Retreat Code")
'Creates recordset as rs
Set rs = New ADODB.Recordset
Set cn = CurrentProject.Connection
'SQL for rs
strSQL = "SELECT * FROM tRetreat WHERE txtRetreatCd = '" & iBox & "'"
'open rs
rs.Open strSQL, cn
retSelect = rs!RetreatID
rs.Close
Set rs = Nothing
DoCmd.OpenForm "fSwitchboard", acNormal
DoCmd.Close acForm, "Form1"
'Error
Handler--------------------------------------------------------------------------------
Exit_PROC_ERR:
Exit Sub
PROC_ERR:
Call ErrorLog("", Module, Err.Number, Err.Description)
End Sub
Thanks in advance!
PJ