Report Preview

  • Thread starter Thread starter Amateur
  • Start date Start date
A

Amateur

I'm trying to preview a report from DB1 in DB2 with help of a coomand button.
This I did so far:
I created the Reference in DB1.

I created in DB 2 a Module like this:

**************************
Public Sub OpenCommissionReport()
DoCmd.OpenReport "salespersonalcommission", acViewPreview
End Sub
***************************

I use the following code for my command button in DB 1

****************************
Private Sub OpenCommissionReport_Click()
OpenSalesPersonalCommission
End Sub
*****************************

I alwauys get the error message "Sub or Function not defined" - Can you tell
me what I did wrong?
Thanks
Klaus
 
from the button you are calling OpenSalesPersonalCommission
and the name of the sub is OpenCommissionReport

The names are different and this is why it can't find it
 
Hi Ofer
I tried severals ways before and now I changed it to like you said (the
result is the same as before) Any other idea?:

***********************
I created in DB 2 a Module like this:

**************************
Public Sub OpenCommissionReport()
DoCmd.OpenReport "salespersonalcommission", acViewPreview
End Sub
***************************

I use the following code for my command button in DB 1

****************************
Private Sub OpenCommissionReport_Click()
OpenCommissionReport
End Sub
*****************************
Thanks
Klaus
 
Hi Klaus

Change the name of the button, not to have the same name as the sub

After the changes are made, just in case, close bothe MDB's.
Check the reference again, mybe it say missing next to one of them,
myebe the reference to the mdb doesn't exist

It should work with the sub or function.
 
Back
Top