Results 1 to 4 of 4
  1. #1
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    Error 424 "Object required" at code in Open event "strArgd = me.OpenArgs.value


    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

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try deleting that line; you don't even use the variable. If you did, I don't think you want .Value, just OpenArgs.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Quote Originally Posted by pbaldy View Post
    Try deleting that line; you don't even use the variable. If you did, I don't think you want .Value, just OpenArgs.
    You are right dont know why I added .value to OpenArgs but Murphy's Law. I am using the variable just not in that code set I sent. Thanks for the prompt reply I guess the strOpen string can't handle an Object ;-)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I think you'd have been fine with:

    strOpen = Me.OpenArgs
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 12-21-2014, 08:21 PM
  2. Replies: 2
    Last Post: 01-15-2014, 07:57 PM
  3. Replies: 1
    Last Post: 03-14-2013, 12:39 PM
  4. Replies: 0
    Last Post: 01-11-2012, 12:34 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums