Calling one form from another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CD Tom
    Contributor
    • Feb 2009
    • 495

    Calling one form from another

    Here's my question. I have a form where user can select how they want to edit a customer, by cust naumber, last name there are about 5 different selections. After the user selects the option say the customer number I want to open another form using that customer number as the where clause.
    I use the following code to open the form
    Code:
    docmd.openform "EditCust",,stdLink
    where the stdlink = custNumber = " & VCustNumber & " When the form comes up it's blank. The forms record source is the customer table. When I look at the forms data it shows the filter as customernumber = the number specified in the stdlink. Any ideas why this is happening.

    Thanks
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    CD Tom,

    It's difficult to know for sure what your stdlink is supposed to be. If your post is accurate, it should reflect:

    Code:
    stdlink = "custNumber = " & VCustNumber
    But, I'm not sure I'm covering all the possibilities here, as the code on your first form is not provided.

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      If TwinnyFo's reply didn't help, then it would be helpfull to see all of the VBA that feeds the line you posted.

      Comment

      • CD Tom
        Contributor
        • Feb 2009
        • 495

        #4
        I figured it out I'm going to use the openArgs to send to the other form. Thanks

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32656

          #5
          I would expect the value of stdLink needs to be :
          Code:
          custNumber = 'XXXXXXX'
          where XXXXXXX is the actual customer number.

          Example Filtering on a Form will give you some tips on this. I would certainly not recommend switching to the use of OpenArgs in this case. It is not more appropriate and is simply an attempt to avoid dealing with a little confusion. That leaves you stuck the next time you want to filter a form properly.

          Comment

          Working...