• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

Method or data Member not found

When I run the following I receive a Compile Error: Method or  data Member not found

Can any help point out my mistake?

Public Function ap_StandardSearchChoice()
      Dim frmCalling As Form
      Dim frmSearchSub As Form
      Dim dynCalling As Recordset
     
      On Error GoTo Error_ap_StandardSearchChoice
     
      Set frmSearchSub = Forms!Contacts!subSearch.Form
      Set frmCalling = Forms(frmSearchSub.Parent.OpenArgs)
      Set dynCalling = frmCalling.Recordset.Clone
     
      If VarType(dynCalling(frmCalling.Tag)) <> vbString Then
        dynCalling.FindFirst frmCalling.Tag & " = " & frmSearchSub(frmCalling.Tag)
      Else
        dynCalling.FindFirst frmCalling.Tag & " = '" & frmSearchSub(frmCalling.Tag) & "'"
      End If
   
      If dynCalling.NoMatch Then
        MsgBox "An Error has occurred, No match record found!", 32, "Search Error!"
      Else
        frmCalling.Bookmark = dynCalling.Bookmark
      End If
   
      dynCalling.Close
   
      DoCmd.Close acForm, "Contacts"

Exit_ap_StandardSearchChoice:
    Exit Function

Error_ap_StandardSearchChoice:

    MsgBox Err.Description, vbCritical, "Search Error"
    Resume Exit_ap_StandardSearchChoice

End Function
0
Leo_Nel
Asked:
Leo_Nel
  • 2
  • 2
  • 2
  • +3
1 Solution
 
LucasMS Dynamics DeveloperCommented:
on which line you get the errer?
0
 
LucasMS Dynamics DeveloperCommented:
disable your error handler and debug it, that would be easier
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Go to the Debug menu, Compile function, and when you get an error message tell us which line has the yellow highlight bar.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Leo_NelAuthor Commented:
I get the error on this line:

 dynCalling.FindFirst frmCalling.Tag & " = " & frmSearchSub(frmCalling.Tag)
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>frmSearchSub(frmCalling.Tag)
If frmCalling is a subform within subSearch?
0
 
Leo_NelAuthor Commented:
Yes, there is a SubForm.
0
 
hkang042997Commented:
Is this function in a standard module?  If so, you have to put code in there to make sure that the main form and subform are open in order for you to access the values of the controls.

If you are certain that both forms are open when this function is executed,  then make sure that frmCalling.Tag contains a valid name of a control in the subform.
0
 
ArjiCommented:
I think you aren't correctly addressing the Tag control in your subform.  this assumes there is a control on your subform named Tag.

dynCalling.FindFirst frmCalling.Tag & " = " & [frmCalling].[Form].Tag
0
 
stevbeCommented:
the code you are using is for DAO (.FindFirst). Do you have a reference to Microsoft DAO Object 3.X Library.  Select the  Tool --> References  menu.

Steve
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.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now