I am getting thie error when I use this piece of code to open the form:
DoCmd.OpenForm "frmDLGgetDocs", acNormal, , , acFormEdit, acDialog, strOpen
where strOpen = "tblContributions:673:Add" I later parse the strOpen in the Open event after getting the OpenArgs value into a variable. The frAddView is an option control with View and Add as the choices
Code:
Private Sub frAddView_Click()
Dim lngID As Long
Dim strArgs() As String
Dim strTbl As String
Dim strCriteria As String
Dim bResult As Boolean
Dim strQry As String
Dim strCode As String
Dim strOpen As String
Dim strCap As String
Dim strTname As String
On Error GoTo ErrorHandler
Const CALLER As String = " Form_frmDLGGetDocs:Form_Open "
Debug.Print Me.Name 'This shows the correct form name
strOpen = Me.OpenArgs.Value 'This is where the error 424 occurs
If Not (IsNull(Me.OpenArgs)) Then
strArgs = Split(Me.OpenArgs, ":")
'create the record source from OpenArgs
Select Case UBound(strArgs)
Case 0 'tblName only
Case 1 'tblName:VIEW OR ADD
Case 2
strTbl = UCase(strArgs(0)) 'name of table
strCriteria = strArgs(2) 'either ADD or VIEW if View use the lngID to show the current Document
lngID = CLng(strArgs(1)) 'either DocTransID or ContributorID
'if lngID = 0 will this give us a blank record to ADD new records
strQry = "SELECT tblEFDocuments.DocID, tblEFDocuments.DocTransID, tblEFDocuments.DocDir, " & _
"tblEFDocuments.DocFileName, tblEFDocuments.DocDate, tblEFDocuments.DocType, " & _
"tblEFDocuments.Notes, tblEFDocuments.DateStart, tblEFDocuments.DateEnd, tblEFDocuments.ContributorID" & _
" From tblEFDocuments" & _
" WHERE (((tblEFDocuments.ContributorID)= " & lngID & "));"
Me.RecordSource = strQry
End Select
'set up titles for form to match OpenArgs strTbl
Select Case strTbl
Case "TBLACCTDETAIL"
'now need to lookup the data using query to fill the fields in frmDLGgetDocs
strTname = " Bank Acct."
strCap = " Documents for " & strTname & "Current Record"
Me.Auto_Header0.Caption = strCap
bResult = True
Case "TBLCONTRIBUTIONS"
strTname = " Donations "
strCap = " Documents for" & strTname & "Current Record"
Me.Auto_Header0.Caption = strCap
bResult = True
End Select
Else
Call MsgBox("You must call this form with OpenArgs. See Programmer John Montgomery", vbCritical, "Add new Document")
End If
End Sub
The code was working and I made some changes and compiled and that is when the error occurred. In desperation after trying other avenues I re-created the form under a new name and copy/pasted the fields fields etc. from the malfunctioning form as well as the code for the Open event and got the same error. By this time I realized that it must be that I can not see the error and I require an unbiased reviewer. Any help would be appreciated. Thanks