Convolutions upon Convolutions (1 Viewer)

Randomblink

The Irreverent Reverend
Local time
Today, 04:32
Joined
Jul 23, 2001
Messages
279
Public Type boObject
frmAction As String
frmApplyForm As Form
frmCurrentForm As Form
tbl_Name As String
tbl_FirstField As String
tbl_SecondField As String
frm_FirstField As Control
frm_SecondField As Control
End Type
---------------------------------------------------------------------
Public Function cdeCmd(Rqst As boObject)
Dim subfrm As Form, frm As Form, strWhereCondition As String
On Error GoTo Err_cde

DoCmd.SetWarnings False
Select Case Rqst.frmAction
Case "optDelete": DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70: DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Case "optAddNew": DoCmd.GoToRecord , , acNewRec
Case "optGotoPrevious": DoCmd.GoToRecord , , acPrevious
Case "optGotoNext": DoCmd.GoToRecord , , acNext
Case "optRefresh": Rqst.frmCurrentForm.Refresh
Case "optCloseCurrent": DoCmd.Close acForm, CStr(Rqst.frmCurrentForm.Name), acSaveYes
Case "optOpenForm": GoSub HowToOpenForm
Case "optCancelExit": Rqst.frmCurrentForm.Undo
Case "optShutDown": DoCmd.Quit
Case "optSaveRecord": DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Case Else: GoTo Exit_cde
End Select


Exit_cde:
DoCmd.SetWarnings True
Exit Function

HowToOpenForm:
Select Case Rqst.frm_FirstField
Case Is <> ""
strWhereCondition = "[" & Rqst.tbl_FirstField & "] = " & CStr(Rqst.frm_FirstField)
DoCmd.OpenForm CStr(Rqst.frmApplyForm.Name), , , strWhereCondition
Case ""
DoCmd.OpenForm CStr(Rqst.frmApplyForm.Name)
End Select
Return

Err_cde:
MsgBox "Error Description: " & CStr(Err.Description) & "Error Number: " & CStr(Err.Number) & "Source: " & CStr(Err.Source)
Resume Exit_cde

End Function
---------------------------------------------------------------------
My section: HOT TO OPEN FORM is giving me errors because when I call this function, the Rqst.frm_FirstField MIGHT be empty...not set...

As a follow up...
---------------------------------------------------------------------
Public Function reboObject(curform As Form, Optional tblNm As String, Optional tblFrstFld As String, _
Optional tblScndFld As String, Optional frmFrstFld As Control, Optional frmScndFld As Control, _
Optional dfnAction As String, Optional ByRef aplForm As Form) As boObject
On Error GoTo Err_def

If IsNull(curform) Then
GoTo St_Action
Else: Set reboObject.frmCurrentForm = curform
End If

St_Action:
reboObject.frmAction = ""
On IsMissing(dfnAction) GoTo St_ApplyToForm
reboObject.frmAction = dfnAction

St_ApplyToForm:
Set reboObject.frmApplyForm = Nothing
On IsMissing(aplForm) GoTo St_TableName
Set reboObject.frmApplyForm = aplForm

St_TableName:
reboObject.tbl_Name = ""
On IsMissing(tblNm) GoTo St_TableFirstField
reboObject.tbl_Name = tblNm

St_TableFirstField:
reboObject.tbl_FirstField = ""
On IsMissing(tblFrstFld) GoTo St_TableSecondField
reboObject.tbl_FirstField = tblFrstFld

St_TableSecondField:
reboObject.tbl_SecondField = ""
On IsMissing(tblScndFld) GoTo St_FormFirstField
reboObject.tbl_SecondField = tblScndFld

St_FormFirstField:
On IsMissing(frmFrstFld) GoTo St_FormSecondField
Set reboObject.frm_FirstField = frmFrstFld

St_FormSecondField:
On IsMissing(frmScndFld) GoTo Exit_def
Set reboObject.frm_SecondField = frmScndFld

Exit_def:
Exit Function

Err_def:
MsgBox Err.Description
Resume Exit_def

End Function
---------------------------------------------------------------------
AND with that explained, this is how I am calling it when I get errors...
---------------------------------------------------------------------
cdeCmd reboObject(Me, , , , , , "optOpenForm", Form_frm_NEW_AccountCreation)
---------------------------------------------------------------------
Can someone help me...?!?!?!
 

Travis

Registered User.
Local time
Today, 02:32
Joined
Dec 17, 1999
Messages
1,332
Which Line does the error occur on?

What is the Error Number?

If it only occurs if the First Field is blank, then why not try trapping for the first field being blank and avoid running any code that requires this field.
 

Users who are viewing this thread

Top Bottom