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