Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Calculation Issue

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
I am having a fairly strange problem. I've been thinking about it all day and cannot for the life of me think what could be causing it...

I have some reports that use functions contained in a module called 'calculations'. These reports will print properly if I right click, print but will not open in print preview?

The database will not compile either.

I think this is all caused by IT department installing Access 2003 on all of my machines on the one day I took off in July. <grumbles>

Any insights on this would be greatly appreciated.

Thanks,

Alex


It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
I have now... No Dice, the only references I have are VBA, Access, ActiveX and OLE Automation. For a little more background, it's giving me 'Invalid Procedure Call or Argument'. Here is the code module in which each function appears to be erroring as I step through. I believe this was written for Access 97, well before my time here anyway....

Code:
Option Compare Database

Function conv(apps, leads) As Single
    If apps = 0 Or IsNull(apps) Then
        conv = 0
    ElseIf leads = 0 Or IsNull(leads) Then
        conv = 0
    Else
        conv = apps / leads
    End If
        
End Function


Function resp(leads, circ) As Single
    If circ = 0 Or IsNull(circ) Then
        resp = 0
    ElseIf leads = 0 Or IsNull(leads) Then
        resp = 0
    Else
        resp = leads / circ
    End If
        
End Function

Function tot_advert_cost(prod_cost, media_cost) As Currency
    tot_advert_cost = IIf(IsNull(prod_cost), 0, prod_cost) + IIf(IsNull(media_cost), 0, media_cost)
End Function

Function media_cost_pp(media_cost, circ) As Currency
    If media_cost = 0 Or IsNull(media_cost) Then
        media_cost_pp = 0
    ElseIf circ = 0 Or IsNull(circ) Then
        media_cost_pp = 0
    Else
        media_cost_pp = media_cost / circ
    End If
End Function

Function gacpl(prod_cost, media_cost, leads) As Currency
    gacpl = tot_advert_cost(IIf(IsNull(prod_cost), 0, prod_cost), IIf(IsNull(media_cost), 0, media_cost)) / IIf(IsNull(leads) Or leads = 0, 1, leads)
End Function

Function cpl(prod_cost, media_cost, leads, tm, ff) As Currency
    cpl = gacpl(prod_cost, media_cost, leads) + ff + tm
End Function

Function cpa(prod_cost, media_cost, leads, tm, ff, apps) As Currency
    If leads = 0 Or apps = 0 Then
        cpa = 0
    Else
        cpa = (IIf(IsNull(leads), 0, leads) / IIf(IsNull(apps), 1000000, apps)) * (gacpl(IIf(IsNull(prod_cost), 0, prod_cost), IIf(IsNull(media_cost), 0, media_cost), IIf(IsNull(leads), 0, leads)) + ff + tm)
    End If
End Function

Is there anything in there that is not Access 2003 compatible? And if so, how would it be able to print the report but not open in print preview?

Thanks for your help,

Alex



It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top