Results 1 to 10 of 10
  1. #1
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    OpenForm Action and Arguments

    Please bear with me as I try to explain this…
    I have a Customer Form with a display only (not enabled) Parts Subform. The Parts Subform has the parent child relationship setup between the parts and customer table.


    I have a push button on the customer level of the customer screen to open a Parts Form to modify it for the customer. I have set up an OpenForm action with the following arguments:
    Parts, Form, , "[Custid]=" & [Custid], , Normal
    When I transfer to the Parts Form all of the parts are displayed and the filter appears not to execute. The bottom of the form does have the icon for the filter. Can you tell me if I am doing something wrong or if I am missing anything?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If [Custid] is a text field then you will need: "[Custid]='" & [Custid] & "'"

  3. #3
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Yes but what if Custid is a number?

    Actually it is a long Int. Is there something different I need to do to get this to work?

    Thanks!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Copy and Paste the actual DoCmd.OpenForm in a post here.

  5. #5
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Here you go...

    Private Sub Add_Part_Click()
    On Error GoTo Err_Add_Part_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Part"
    MsgBox stLinkCriteria
    stLinkCriteria = "[Custid]=" & Me![Custid]
    MsgBox stLinkCriteria
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_Add_Part_Click:
    Exit Sub
    Err_Add_Part_Click:
    MsgBox Err.Description
    Resume Exit_Add_Part_Click

    End Sub

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    SubForm is a technical term for a form that is displayed on another form by means of a SubFormControl. Your code is simply opening another MainForm named "Parts". The Master/Child relationship only works on actual SubForms, not between mainForms.

  7. #7
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Got you..Is there a way I can send the custid to the new form and

    only retrieve the parts for that customer?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How does the Parts form retrieve only parts for a single customer?

  9. #9
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40
    What I was hoping to do is to pass the customer id into the form, and use that number to query only the parts for that customer. Is it possible to do something like this? I would also like to have it available to the form so if the user presses the add part button, it will copy it into the customer id field.

    Thank your for all of your help.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just use the OpenArgs argument of the OpenForm command to pass the customer id and watch for it in the Open event of the next form.

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

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 03:43 PM
  2. StopMacros action in 2007
    By jcmartell in forum Programming
    Replies: 0
    Last Post: 04-25-2007, 09:04 AM

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