I have been asked to fix an issue after converting data from Access 2000 to 2007. It is only in one Form the problem exists.
The task required is to go from a list view of clients to a detailed view of one single record in the list by double clicking the record.
Should be simple and it works in 5 screens, but not in the main screen.
I have copied the code below (seems like a bit too much duplication to achieve this...): The code below DOES NOT work and always brings the same record up. Not the 1st or last record, but record number 7 with ID=1453
Option Compare Database
Private Sub Jump_To_Detail()
Dim inLink As Integer
inLink = [ID]
DoCmd.OpenForm "Client Detail"
Forms![Client Detail]![ID].SetFocus
DoCmd.FindRecord inLink
Forms![Client Detail]![Name].SetFocus
End Sub
Private Sub ExitButton_Click()
DoCmd.Close
End Sub
Private Sub Address_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Email_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Fax_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub ID_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Name_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Notes_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Phone_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Postcode_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Website_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
An identical approach in another screen works great. Code that works below. I cannot see any real difference and believe it is a bit unexplainable why the first code stopped working after moving to Access 2007.
Option Compare Database
Private Sub Jump_To_Detail()
Dim inLink As Integer
inLink = [ID]
DoCmd.OpenForm "Enquiry Detail"
[Forms]![Enquiry Detail]![ID].SetFocus
DoCmd.FindRecord inLink
[Forms]![Enquiry Detail]![ClientID].SetFocus
End Sub
Private Sub Client_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Project_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Contact_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Date_Chased_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Date_Letter_Sent_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Enquiry_Date_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Notes_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Origin_of_Enquiry_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Site_Address_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Any pointers on how to either rewrite this code or fix it would be appreciated. I expect a FindRecord is failing due to a wrong index or something.
I was much better at faultfinding in FoxPro using DOS....
Thanks.
The task required is to go from a list view of clients to a detailed view of one single record in the list by double clicking the record.
Should be simple and it works in 5 screens, but not in the main screen.
I have copied the code below (seems like a bit too much duplication to achieve this...): The code below DOES NOT work and always brings the same record up. Not the 1st or last record, but record number 7 with ID=1453
Option Compare Database
Private Sub Jump_To_Detail()
Dim inLink As Integer
inLink = [ID]
DoCmd.OpenForm "Client Detail"
Forms![Client Detail]![ID].SetFocus
DoCmd.FindRecord inLink
Forms![Client Detail]![Name].SetFocus
End Sub
Private Sub ExitButton_Click()
DoCmd.Close
End Sub
Private Sub Address_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Email_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Fax_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub ID_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Name_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Notes_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Phone_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Postcode_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Website_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
An identical approach in another screen works great. Code that works below. I cannot see any real difference and believe it is a bit unexplainable why the first code stopped working after moving to Access 2007.
Option Compare Database
Private Sub Jump_To_Detail()
Dim inLink As Integer
inLink = [ID]
DoCmd.OpenForm "Enquiry Detail"
[Forms]![Enquiry Detail]![ID].SetFocus
DoCmd.FindRecord inLink
[Forms]![Enquiry Detail]![ClientID].SetFocus
End Sub
Private Sub Client_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Project_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Contact_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Date_Chased_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Date_Letter_Sent_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Enquiry_Date_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Notes_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Origin_of_Enquiry_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Private Sub Site_Address_DblClick(Cancel As Integer)
Call Jump_To_Detail
End Sub
Any pointers on how to either rewrite this code or fix it would be appreciated. I expect a FindRecord is failing due to a wrong index or something.
I was much better at faultfinding in FoxPro using DOS....
Thanks.
Last edited: