Forum Discussion
Sue_69
Sep 09, 2023Copper Contributor
Northwind Traders Developer 2.2 Template
I think there's a bug in the Northwind Traders Developer 2.2 Template. When I click the Companies button to open the Customers list, then click a Customer ID, I'm correctly presented with the Customer form which shows the Customer info, a list of Orders on the right, and a list of Contacts at the bottom.
When I click the ID of a Contact from the bottom list, I get an error message. Checking the form, the on_click event of the txtContactID object is trying to call =OpenForm_frmOrderDetails(), which is incorrect, since this is a Contact ID, not an Order ID. In fact, every field on the sfrmCompanyDetail_Contacts form has the same code in the on_click event.
The error message is "The expression On Click you entered as the event property setting produced the following error: The expression you entered has a function name that Northwind Traders Developer Edition 2.2 can't find."
I also don't see any form related to Contacts, except for the subform on the Customer form (frmCompanyDetail). Is this a known bug? Is this being addressed? I'm using this template to create an app where Contacts are quite important, and I'm while I've created a Contact form, I'm having trouble trying to figure out how to launch it from the subform like the Orders are.
Any help would be appreciated.
Thank you for pointing this out. Yes it is a bug, going back all the way to version 2.0 from April-2023. It probably happened when another subform was copied to become the Contacts subform. Event procedures like “=OpenForm_frmOrderDetails()” are copied with it.
The solution is to remove the OnClick/OnDblClick properties from the fields in sfrmCompanyDetail_Contacts. There never was a Contacts form; it is not needed in Northwind since all fields from Contacts table are on the subform.To answer your question how to open a Contacts form if there was one, I would direct you to sfrmCompanyDetail_CustomerOrders, where we are doing an analogous thing: opening the Order that is being clicked on.
The OrderID is formatted as hyperlink to give a visual indication that it can be clicked on.
Its Click event calls a function OpenForm_frmOrderDetails(), which is in the code behind this subform. If you want to allow multiple Contact forms to be open at the same time, continue following this code into OpenOrderDetailsForm and implement a similar procedure. If you only want one contact, then a simple DoCmd.OpenForm “yourContactForm”, WhereCondition:=”ContactID=” & Me.txtContactID will do.
4 Replies
Sort By
- Tom_van_StiphoutSteel Contributor
Thank you for pointing this out. Yes it is a bug, going back all the way to version 2.0 from April-2023. It probably happened when another subform was copied to become the Contacts subform. Event procedures like “=OpenForm_frmOrderDetails()” are copied with it.
The solution is to remove the OnClick/OnDblClick properties from the fields in sfrmCompanyDetail_Contacts. There never was a Contacts form; it is not needed in Northwind since all fields from Contacts table are on the subform.To answer your question how to open a Contacts form if there was one, I would direct you to sfrmCompanyDetail_CustomerOrders, where we are doing an analogous thing: opening the Order that is being clicked on.
The OrderID is formatted as hyperlink to give a visual indication that it can be clicked on.
Its Click event calls a function OpenForm_frmOrderDetails(), which is in the code behind this subform. If you want to allow multiple Contact forms to be open at the same time, continue following this code into OpenOrderDetailsForm and implement a similar procedure. If you only want one contact, then a simple DoCmd.OpenForm “yourContactForm”, WhereCondition:=”ContactID=” & Me.txtContactID will do.- Sue_69Copper Contributor
Tom_van_Stiphout thank you so much for this info!
- George_HepworthSilver ContributorThank you. We will follow up.
- Anonymous