Results 1 to 8 of 8
  1. #1
    gskinstad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    6

    Click field in Subform to open another form filtered by that field's value

    Hi All

    Sorry to bother everyone with a newbie question, but I could really do with some help.

    I am creating a database which tracks outstanding invoices by customer. I have a query which filters for only unpaid invoices, and this is displayed as a subform in a form which has the customer name and account number on it. It enables me to see all outstanding invoices by customer.

    I have another form in which each record is an individual invoice, and it has a subform within it which tracks "Chasers". So everytime payment is chased, a record is entered to keep track of when the invoice was traced and what the outcome was.

    What I would like to do is double click the invoice number on the first form, and for it to then open the other form filtered by that invoice number.

    I typed in the following code

    DoCmd.Openform "frm_ProformaInvoices",,,"Sales_order =" & Me.Sales_order

    All I get when I run it is a pop up box asking for a value

    Where am I going wrong?



    Appreciate any advice

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    are you double clicking on a record in the main form, or in the subform?

    if in the subform then use the full syntax for the control [Sales_order] with main form object, subform object, control

    hope this helps.

  3. #3
    gskinstad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    6
    Thanks - its I am double clicking in the subform

    Can you give me an example of what the syntax would be?

    The subform name is frm_proformainvoicesunpaid

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The parameter prompt implies that one of the names is wrong. Does your field really have an underscore, or might it have a space? Double check the spelling of everything.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    gskinstad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    6
    Right, I have changed the syntax to include thecontrol [Sales_order] with main form object, subform object, control which looks as follows

    Private Sub Sales_Order_DblClick(Cancel As Integer)


    DoCmd.OpenForm "frm_ProformaInvoices", , , "[Sales order] = " & Me.Form![frm_ProformasbyCustomers].Form![qry_ProformaInvoicesUnpaid subform1].[Sales order]



    End Sub


    However I now get the following error message





    Please excuse the sloppy naming - I am going to clean this up

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You don't want the "Me." in there:

    Forms Refer to Form and Subform properties and controls
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    gskinstad is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    6
    Thanks - however no matter what I do, I still get the following message

    "The expression On DBl CLick you entered as the event proprty setting produced the following error: A problem occured while Customer Database was communicating with the OLE server or ActiveX control"

    No idea what to do now

    :-(

  8. #8
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    Forms!MainFormName.SubFormName.Form!ControlName

    where ever it says 'name' - you use your actual object name instead the rest is literal. be sure to use [ ] if your object names are not 1 word.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  2. Open form to filtered records
    By ducecoop in forum Access
    Replies: 3
    Last Post: 10-22-2010, 10:53 AM
  3. Replies: 1
    Last Post: 03-03-2010, 07:29 PM
  4. Mouse click to open form
    By darryl.charles in forum Programming
    Replies: 0
    Last Post: 09-05-2008, 10:33 AM
  5. In a field on a Form, on click open another form
    By jackieagra in forum Programming
    Replies: 1
    Last Post: 03-20-2008, 09:44 AM

Tags for this Thread

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