CraigWarmy
02-13-2009, 11:12 AM
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
Rabbie
02-13-2009, 11:24 AM
Can you post the VBA of the the entire Function from the the Function line to the End Function line
CraigWarmy
02-13-2009, 11:33 AM
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
boblarson
02-13-2009, 11:44 AM
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.