Good Afternoon Everyone,
I try to keep code to a minimum because it just never seems to work when I do it but does anyone see anything wrong with this code?
If Me.CustNum = Null Then
DoCmd.OpenReport "rptCertOfCompBlank", acViewPreview
Else
DoCmd.OpenReport "rptCertOfComp", acViewPreview, , "intCustomerNum =" & Me.intCustomerNum
End If
These are the commands I used for a command button to open a report. If the form is at the "New Record" stage, I would like it to open a blank Certificate of Completion form and if it is at a completed record then I want it to open the Certificate of Completion with all the data filled in each line. Many salesmen like the blank form so that they can just write in the information at their convenience while other more elitist types like to have it all typed in professionally. It is strange that the more complicated line after the 'Else' works fine, it is only when it is at the 'New Record' Mode that I get errors instead of a blank form. The error is some type of syntax error that refers to the line after the 'Else' but again, it should be operating off the first 'DoCmd' line unless I am totally screwed up which is not beyond the realm!
Me.CustNum is Null according to the watch and so I would think that the report "rptCertOfCompBlank" would open but it jumps right over that line to the 'Else' and tries to perform that next command. It is as if the first "DoCmd.OpenReport" line does not exist. I would understand it if the "Me.CustNum = Null" was not true. But it is true and so I am missing something....well I am probably missing a lot but I would still like to get this to work.
I hope I have put enough information in and I would appreciate it if anyone has any suggestions. Thanks and have a good day!
Dave