Passing Form as Openarg

Hi,
Runnung MS Access 2013, Windows 7.

I want to pass a form name as an openarg when opening a pop-up form, then access the recordsetclone of the passed form.
In the main form I call the pop-up as follows:
DoCmd.OpenForm "frmClientSearchResults", , , , , acDialog, Me.Name 'open the pop-up form

Open in new window


In the pop-up form one of the routines tries to do the following, but I'm getting a compile error "invalid use of property" on the second line (CallingForm = Me.OpenArgs)
Dim CallingForm As Form
CallingForm = Me.OpenArgs
With CallingForm.RecordsetClone
    .FindFirst "[client_id]=" & Me.client_id
    If .NoMatch Then
        MsgBox "Client not Found"
    Else
        CallingForm.Section(0).Visible = True
        CallingForm.Bookmark = .Bookmark
    End If
End With

Open in new window


Can anyone help please?
redpoppyAsked:
Who is Participating?
 
GozrehCommented:
Set CallingForm = Forms(Me.OpenArgs)
0
 
redpoppyAuthor Commented:
Wow, that's the fastest response I've ever had and it sorted my problem Thanks for such a quick answer, much appreciated
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.