Hi, I've been very frustrated for 2 days trying to make this work. I started with a built-in template "Projects" that came with Access 2007. On the "Employee List" I can click on any cell and bring up the Employee Detail" corresponding to that particular cell. That works fine. I want to be able to open "Employee Detail" when I click on a cell in "Project Detail". I got to the point that "Employee Detail" opens but only to the frst record. PLEASE help!
Here’s the code for double clicking on any cell in “employee list”. This works!
Function macro5()
DoCmd.OpenForm "Employee Details", acNormal, "", "[ID]=" & .ID, , acDialog
TempVars.Add "CurrentID" , "[ID]"
DoCmd.Requery ""
DoCmd.SearchFor Record , "", acFirst, "[ID]=" & TempVars!Curren tID
TempVars.Remove "CurrentID"
Exit Function
Here is the VBA Code for double clicking on the “Principal in Charge”. I added the message box to see which record is shown.
Dim curr_rec As String
Private Sub Principal_in_Ch arge_DblClick(C ancel As Integer)
curr_rec = [Principal in charge]
DoCmd.OpenForm FormName:="empl oyee details"
Forms![employee details].SetFocus
DoCmd.GoToRecor d , , acGoTo, curr_rec
MsgBox (curr_rec)
End Sub
Here’s the code for double clicking on any cell in “employee list”. This works!
Function macro5()
DoCmd.OpenForm "Employee Details", acNormal, "", "[ID]=" & .ID, , acDialog
TempVars.Add "CurrentID" , "[ID]"
DoCmd.Requery ""
DoCmd.SearchFor Record , "", acFirst, "[ID]=" & TempVars!Curren tID
TempVars.Remove "CurrentID"
Exit Function
Here is the VBA Code for double clicking on the “Principal in Charge”. I added the message box to see which record is shown.
Dim curr_rec As String
Private Sub Principal_in_Ch arge_DblClick(C ancel As Integer)
curr_rec = [Principal in charge]
DoCmd.OpenForm FormName:="empl oyee details"
Forms![employee details].SetFocus
DoCmd.GoToRecor d , , acGoTo, curr_rec
MsgBox (curr_rec)
End Sub