Compile Error Method or Data Member not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhonda6373
    New Member
    • Mar 2010
    • 35

    Compile Error Method or Data Member not found

    Good morning,

    I am not an experienced user and have a basic question. I have a main form named Test Cases which has a subform called TestSteps. The subform TestSteps has a field named StepDescription . I want the user to be able to click on the field StepDescription and open another form UnitTestCase. I want Unit Test Case to open where StepDescription on TestSteps matches TestCaseID on UnitTestCase. Both fields are text fields.

    Here is the code I am using
    Code:
     Const cstrForm As String = "UnitTestCase"  
        DoCmd.OpenForm cstrForm, WhereCondition:="[TestCaseID]=" & Me.StepDescription
        End Sub
    I am getting a compile error that StepDescription Compile Error Method or Data Member not found.

    Can anyone assist? I really appreciate the help!
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3653

    #2
    Rhonda,

    Have you thought of making UnitTestCase a subform? If the relationships and forms are built properly, the form should automatically filter based on the desired field.

    It is difficult to tell exactly how your forms/tables are related to each other, although we can make certain assumptions based on your description.

    Comment

    • rhonda6373
      New Member
      • Mar 2010
      • 35

      #3
      Please disregard my first message -- I found a mistake and corrected it.

      Comment

      • twinnyfo
        Recognized Expert Moderator Specialist
        • Nov 2011
        • 3653

        #4
        OK - Glad you found a resolution.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Line 2 of code.
          Might I suggest that you create the conditional as a separate string first, then use the string viable in the function. The string can then be tested for missing values before making the call to the function.

          Code:
             Const cstrForm As String = "UnitTestCase"
             Dim strconditional as string
             strconditional = "[TestCaseID]=" & Me.StepDescription
          '
          'Now a debug.print can show you the result
          'or you can test to see if the strconditional
          'has a value from me.stepdescription
          '
             DoCmd.OpenForm cstrForm, WhereCondition:= strconditional
          End Sub

          Comment

          Working...