G
Guest
I have a table (1), one subform (2) and another "subform" (3), which is a
form being opened by a command button on the subform (2). I have been
agonizing over this for at least a week and cannot for the life of me figure
out what is wrong. (However, in my journey I have learned how to debug and
use the immediate window!)
The last straw was when I fixed one problem only to have a Type Mismatch
error! Below is the code for the command button on the subform (2):
Private Sub cmdbtnProgressNotes_Click()
On Error GoTo Err_cmdbtnProgressNotes_Click
Dim strLinkCriteria As String
Dim strDocName As String
strDocName = "subfrmToDoProgressNotes"
' If ToDoInstructionsID control is blank, display a message.
If IsNull(Me![ToDoInstructionsID]) Then
Me![ToDoInstructionsID].SetFocus
Else
' Otherwise, open Product List form, showing products for current
supplier.
strDocName = "subfrmToDoProgressNotes"
strLinkCriteria = "ToDoInstructionsID =
Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID"
DoCmd.OpenForm strDocName, acFormAdd, , , strLinkCriteria
End If
Exit_cmdbtnProgressNotes_Click:
Exit Sub
Err_cmdbtnProgressNotes_Click:
MsgBox Err.Description
Resume Exit_cmdbtnProgressNotes_Click
End Sub
and this is the code on Current for the subform (2):
Private Sub Form_Current()
' This code created by Form Wizard.
Dim strParentDocName As String
On Error Resume Next
strParentDocName = Me.Parent.Name
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![subfrmProgressNotes].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit
End Sub
Can somebody please tell where I have gone wrong? Thanks.
form being opened by a command button on the subform (2). I have been
agonizing over this for at least a week and cannot for the life of me figure
out what is wrong. (However, in my journey I have learned how to debug and
use the immediate window!)
The last straw was when I fixed one problem only to have a Type Mismatch
error! Below is the code for the command button on the subform (2):
Private Sub cmdbtnProgressNotes_Click()
On Error GoTo Err_cmdbtnProgressNotes_Click
Dim strLinkCriteria As String
Dim strDocName As String
strDocName = "subfrmToDoProgressNotes"
' If ToDoInstructionsID control is blank, display a message.
If IsNull(Me![ToDoInstructionsID]) Then
Me![ToDoInstructionsID].SetFocus
Else
' Otherwise, open Product List form, showing products for current
supplier.
strDocName = "subfrmToDoProgressNotes"
strLinkCriteria = "ToDoInstructionsID =
Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID"
DoCmd.OpenForm strDocName, acFormAdd, , , strLinkCriteria
End If
Exit_cmdbtnProgressNotes_Click:
Exit Sub
Err_cmdbtnProgressNotes_Click:
MsgBox Err.Description
Resume Exit_cmdbtnProgressNotes_Click
End Sub
and this is the code on Current for the subform (2):
Private Sub Form_Current()
' This code created by Form Wizard.
Dim strParentDocName As String
On Error Resume Next
strParentDocName = Me.Parent.Name
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![subfrmProgressNotes].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit
End Sub
Can somebody please tell where I have gone wrong? Thanks.