hi Wei,
Perhaps before you open the report, make sure you save the record if it is dirty?
kind regards,
crystal
On 7/17/2020 12:56 PM, Wei Qian via groups.io wrote:
I put the following code in the form's OK button, click event, using Duane's function. The query property changed as I wanted, but I will got an error saying"run time error 2585. This action can not be carried out while processing a form or report event" after clicking OK, and debug will lead to the last line code of DoCmd.OpenReport. The report sometimes does run if I close out and stop the debugger, sometimes doesn't. I googled and it seems this is the command to open the report. I don't have front end programming experience. What did I do wrong?
Thanks very much!
~ Wei
Private Sub OK_Click()Dim strSQL As StringDim strOldSQL As StringstrSQL = "SELECT * FROM vWorkOrders " & _"WHERE MaxOfReleaseDate BETWEEN '" & Me.txtStart & "' AND '" & _Me.txtEnd & "' "If Not IsNull(Me.cbQRFType) ThenstrSQL = strSQL & " AND QRFTypeDescr = '" & Me.cbQRFType & "' "End IfIf Not IsNull(Me.txtClassCode) ThenstrSQL = strSQL & " AND Class = '" & Me.txtClassCode & "' "End IfstrSQL = strSQL & "ORDER BY [SN/LotStart], WorkOrderNo;"strOldSQL = fChangeSQL("Instruments Query", strSQL)DoCmd.OpenReport ReportName:="Instruments Detail Report"End Sub
Tidak ada komentar:
Posting Komentar