J
jon
Hi
I have a form with a subform which is populated from a query.
When I press the button the code below runs
The problem is when the form is opened and the button pressed I get the
error "can't find 'count-baan' referred to in your expression "
but if I open up the form in design view then go back to form view all works
ok.
Can someone please advise where my error is.
the code for the button and the SQL for the query is below.
Thanks
Jon
Private Sub Cmd_openBaan_Click()
On Error GoTo Err_Cmd_openBaan_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CmmBaanEntry"
stLinkCriteria = "[Count-baan]=" & [Fr-Cmm_DueNow subform]![Count-baan]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Cmd_openBaan_Click:
Exit Sub
Err_Cmd_openBaan_Click:
MsgBox Err.Description
Resume Exit_Cmd_openBaan_Click
SELECT Baan.OrderNo, Baan.Job, Componets.[Componet short Name],
Baan.dateIcyBaan, Baan.CmmDate, Componets.Frame, Componets.inspected,
Baan.DueDate, Baan.[Count-baan]
FROM Componets INNER JOIN (ComponentNos INNER JOIN Baan ON
ComponentNos.[Componet No] = Baan.Job) ON Componets.RefNo =
ComponentNos.RefNo
WHERE (((Baan.dateIcyBaan) Is Not Null) AND ((Baan.CmmDate) Is Null) AND
((Componets.inspected)=True))
ORDER BY Baan.DueDate;
End Sub
I have a form with a subform which is populated from a query.
When I press the button the code below runs
The problem is when the form is opened and the button pressed I get the
error "can't find 'count-baan' referred to in your expression "
but if I open up the form in design view then go back to form view all works
ok.
Can someone please advise where my error is.
the code for the button and the SQL for the query is below.
Thanks
Jon
Private Sub Cmd_openBaan_Click()
On Error GoTo Err_Cmd_openBaan_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CmmBaanEntry"
stLinkCriteria = "[Count-baan]=" & [Fr-Cmm_DueNow subform]![Count-baan]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Cmd_openBaan_Click:
Exit Sub
Err_Cmd_openBaan_Click:
MsgBox Err.Description
Resume Exit_Cmd_openBaan_Click
SELECT Baan.OrderNo, Baan.Job, Componets.[Componet short Name],
Baan.dateIcyBaan, Baan.CmmDate, Componets.Frame, Componets.inspected,
Baan.DueDate, Baan.[Count-baan]
FROM Componets INNER JOIN (ComponentNos INNER JOIN Baan ON
ComponentNos.[Componet No] = Baan.Job) ON Componets.RefNo =
ComponentNos.RefNo
WHERE (((Baan.dateIcyBaan) Is Not Null) AND ((Baan.CmmDate) Is Null) AND
((Componets.inspected)=True))
ORDER BY Baan.DueDate;
End Sub