Access 2003 Error 2448 causing problems

CraigWarmy

Registered User.
Local time
Yesterday, 18:27
Joined
Feb 13, 2009
Messages
30
I been starting to getting the error 2448. Access Help offers nothing. Basically it is holding my applications up. Here is the code:
Set Cab = New Cabinets
Set Acc = New Accessories
cCabAmount = Cab.GetRoomTotalCost(nRoomID)
cAccAmount = Acc.GetRoomTotalCost(nRoomID)
cAmount = cCabAmount + cAccAmount
Set Cab = Nothing
Set Acc = Nothing
CalculateSubTotal = cAmount

End Function

I get the error at the End Function.

TIA
--Craig
 
Can you post the VBA of the the entire Function from the the Function line to the End Function line
 
First line:
With Forms("frmPricing")
'Now we need to get the price of the cabinet.
Me.CabinetCost = Cabinets.GetCost(nCabinetNameID, nQty)
.Controls("RoomSubTotal") = CalculateSubTotal(nRoomID)
--------------------------------------------------------------
Then:

Public Function CalculateSubTotal(nRoomID As Long) As Currency

Dim Cab As Cabinets
Dim Acc As Accessories
Dim cAmount As Currency
Dim cCabAmount As Currency
Dim cAccAmount As Currency

Set Cab = New Cabinets
Set Acc = New Accessories

cCabAmount = Cab.GetRoomTotalCost(nRoomID)
cAccAmount = Acc.GetRoomTotalCost(nRoomID)
cAmount = cCabAmount + cAccAmount

Set Cab = Nothing
Set Acc = Nothing

CalculateSubTotal = cAmount

End Function
----------------------------------------------------
The class functions for Cab and Acc return their values just fine. Even when the cAmount returns the calculated values to the CalculateSubTotal. When it hits the End Function is when the error occurred. I even bought a new bug detector for my computer. No help for that either.

--Craig
 
I'm guessing that it would be this line:

.Controls("RoomSubTotal") = CalculateSubTotal(nRoomID)

Which is telling you you can't assign a value to that object and that makes sense because now as I'm writing this, I know the syntax is:

.Controls("RoomSubTotal").Value = CalculateSubTotal(nRoomID)

You have to include the .Value when you use Controls("Whatever") as it doesn't have a default of .value when you do it that way.
 

Users who are viewing this thread

Back
Top Bottom