Hello,
I have a continuous subform (usersub) on my mainform (frmMenu) with a command button - i'm trying to set the link criteria on the button to open another form (frmtasks) based on the (studentname) field in my subform and (studentname) in (frmtask).
both fields are text and there is only ever one entry in (usersub) displayed at all times when (frmMenu) is open
I used the form wizard to generate the code and added a little bit - but its not actually working - the subform control and the form its based on are the same name (usersub) - and i'm using A2007
Private Sub Command249_Click()
On Error GoTo Err_Command249_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmtask"
stLinkCriteria = "[studentname]=" & "'" & Me.Forms![frmMenu]![usersub].Form![usersub].Form![studentname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command249_Click:
Exit Sub
Err_Command249_Click:
MsgBox Err.Description
Resume Exit_Command249_Click
End Sub
I've also tried
stLinkCriteria = "[studentname]=" & "'" & Me.Forms![frmMenu]![usersub].Form![studentname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to no avail. I've searched on the web - but I've not found anything that's really helped.
Thank you for any additional help
I have a continuous subform (usersub) on my mainform (frmMenu) with a command button - i'm trying to set the link criteria on the button to open another form (frmtasks) based on the (studentname) field in my subform and (studentname) in (frmtask).
both fields are text and there is only ever one entry in (usersub) displayed at all times when (frmMenu) is open
I used the form wizard to generate the code and added a little bit - but its not actually working - the subform control and the form its based on are the same name (usersub) - and i'm using A2007
Private Sub Command249_Click()
On Error GoTo Err_Command249_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmtask"
stLinkCriteria = "[studentname]=" & "'" & Me.Forms![frmMenu]![usersub].Form![usersub].Form![studentname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command249_Click:
Exit Sub
Err_Command249_Click:
MsgBox Err.Description
Resume Exit_Command249_Click
End Sub
I've also tried
stLinkCriteria = "[studentname]=" & "'" & Me.Forms![frmMenu]![usersub].Form![studentname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to no avail. I've searched on the web - but I've not found anything that's really helped.
Thank you for any additional help