Run time erro 438

donsi

Registered User.
Local time
Today, 09:44
Joined
Sep 1, 2016
Messages
73
Hi all,

I am getting a runtime error when I am referencing a control of an open form in the module I created to print a report. I want to print a report if there is any value other than "0" in the txtbox of the form called DropAmount. I needed to create a module for the print job to be submitted for various reasons. so couldn't do me.dropamount <> 0 (it worked when I did a print code from the form itself with "Me.dropamount).


Code:
Public Sub PrintDrop()
'Printing a Drop
    If [Forms]![FrmBankReturns]![SubFrmBanksReturn].DropAmount <> 0 Then
        DoCmd.OpenReport "RptDropFrm", acViewNormal, "", "[ID]=[Forms]![FrmBankReturns]![SubFrmBanksReturn]![ID]", acNormal, OpenArgs:="Cashier Copy"
        DoCmd.OpenReport "RptDropFrm", acViewNormal, "", "[ID]=[Forms]![FrmBankReturns]![SubFrmBanksReturn]![ID]", acNormal, OpenArgs:="Employee Copy"
        CKGoodPrintOut
    End If
End Sub
 
See if this info on form/subform control references is helpful.

I also think your quotes are misplaced in
"[ID]=[Forms]![FrmBankReturns]![SubFrmBanksReturn]![ID]"

The quoted text will be considered a text value. You want the info on right hand of = to be evaluated.

Good luck.
 
That was very helpful link. Just needed to add “form” before “Dropamount”
The second part works just fine.
 

Users who are viewing this thread

Back
Top Bottom