I have the following code on frmClasses which closes this form and opens frmCompetencies, so far, everything works fine...
Private Sub CmdCompetencies_Click()
On Error GoTo Err_CmdCompetencies_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCompetencies"
stLinkCriteria = "[ClassID]=" & Me![ClassID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdCompetencies_Click:
Exit Sub
Err_CmdCompetencies_Click:
MsgBox Err.Description
Resume Exit_CmdCompetencies_Click
End Sub
However...
I want to be able to then close frmCompetencies and open frmClasses based on the same classID. So I tried the same approach to opening frmCompetencies but it doesn't open on the classID instead it opens as if I was adding a new class.
Private Sub CmdReturnToClass_Click()
On Error GoTo Err_CmdReturnToClass_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClasses"
stLinkCriteria = "[ClassID]=" & Me![ClassID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdReturnToClass_Click:
Exit Sub
Err_CmdReturnToClass_Click:
MsgBox Err.Description
Resume Exit_CmdReturnToClass_Click
I would appreciate it if someone could suggest how I may be able to accomplish this task. The reason I want to close the forms is to speed up requeries.
cheers
Tanya
Private Sub CmdCompetencies_Click()
On Error GoTo Err_CmdCompetencies_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCompetencies"
stLinkCriteria = "[ClassID]=" & Me![ClassID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdCompetencies_Click:
Exit Sub
Err_CmdCompetencies_Click:
MsgBox Err.Description
Resume Exit_CmdCompetencies_Click
End Sub
However...
I want to be able to then close frmCompetencies and open frmClasses based on the same classID. So I tried the same approach to opening frmCompetencies but it doesn't open on the classID instead it opens as if I was adding a new class.
Private Sub CmdReturnToClass_Click()
On Error GoTo Err_CmdReturnToClass_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClasses"
stLinkCriteria = "[ClassID]=" & Me![ClassID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdReturnToClass_Click:
Exit Sub
Err_CmdReturnToClass_Click:
MsgBox Err.Description
Resume Exit_CmdReturnToClass_Click
I would appreciate it if someone could suggest how I may be able to accomplish this task. The reason I want to close the forms is to speed up requeries.
cheers
Tanya