Results 1 to 2 of 2
  1. #1
    chrisjack001 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    12

    Opening another form with specific record double clicked on in Sub Form

    I have a Subform “ReqsAndCategories Subform”in an Access 2007 Database. This Subform has six fields. 5 of the fields are


    ReqAndBudgetID (Primary Key)
    Prefix
    ReqNumber
    BudgetID
    Amount
    get their Data source from a table called ReqsAndBudget. The remaining field called

    Compressed Person Name - Example of such data is “LastName, FirstName – ()

    Is linked to another table called Vendors. The Data Row Source for this field has the following Select Statement

    SELECT Vendors.EmployeeAutoID, [Vendors]![Compressed Person Name] & " - (" & [Vendors]![FY] & ")" AS [Compressed Person Name] FROM Vendors WHERE (((Vendors.Person)=True)) OR (((Vendors.Group)=True)) ORDER BY [Vendors]![Compressed Person Name] & " - (" & [Vendors]![FY] & ")";

    I have another Form in the database called “VendorsNew”. The Record source for this form is a query called Vendorsqry and the SQL for this Query is

    SELECT Vendors.EmployeeAutoID, Vendors.[Compressed Person Name], Vendors.[Assigned To Org Id], Vendors.[Person Nbr], Vendors.[Position Nbr], Vendors.[Short Job Title], Vendors.[Pct Time], Vendors.FY
    FROM Vendors;

    This form has seven fields which are

    Compressed Person Name
    Assigned To Org Id
    Person Nbr
    Position Nbr
    Short Job Title
    Pct Time
    FY

    The “Compressed Person Name” field has the same Select Statement in the Data Row Source like in the “ReqsAndCategories Subform” which is

    SELECT Vendors.EmployeeAutoID, [Vendors]![Compressed Person Name] & " - (" & [Vendors]![FY] & ")" AS [Compressed Person Name] FROM Vendors WHERE (((Vendors.Person)=True)) OR (((Vendors.Group)=True)) ORDER BY [Vendors]![Compressed Person Name] & " - (" & [Vendors]![FY] & ")";

    I want to create a VB code in the “Compressed Person Name” field of the Subform under the "Dbl Click" property that will open the VendorsNew form when clicked in Dataview. I want the VendorsNew form to open that specific record that is double clicked on in the “ReqsAndCategories Subform” . The VendorsNew form should display Most or All of the records that have that name clicked on.

    Currently the code I have is

    DoCmd.OpenForm "VendorsNew",,,"Compressed Person Name = " & Me.Compressed Person Name

    But I am getting Errors. Can you please help me. I don’t know what I’m doing wrong to open the VendorsNew form with that specific record.
    Attached is a copy of the database

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Haven't looked at the sample yet, but if that's actually a name, the syntax is slightly different for a text value:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 04-20-2013, 10:12 AM
  2. Opening another form by double click
    By chrisjack001 in forum Access
    Replies: 1
    Last Post: 10-13-2010, 02:19 PM
  3. Opening a form at a blank record
    By Remster in forum Forms
    Replies: 2
    Last Post: 09-14-2010, 07:46 AM
  4. Replies: 6
    Last Post: 04-23-2010, 06:43 AM
  5. Print a specific record report from a form
    By cynthiacorley in forum Reports
    Replies: 27
    Last Post: 02-08-2010, 06:34 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