OldValue gives me error 438 "not supported" (1 Viewer)

Karl K

Registered User.
Local time
Today, 01:29
Joined
Feb 2, 2000
Messages
41
How to add a method? Its there in the library, the library is activated, VB recognized OldValue (it capitalizes it correctly when I type "oldvalue". But when I run it, it gives me error 438 - "Object doesn't support this property or method."

the code looks like this:
Private Sub QuantityOrdered_BeforeUpdate(Cancel As Integer)
'After changing quantity, we check if it is in stock
Dim intNumInStock As Integer
Dim intNewQuan As Integer
Dim intOriginalQuan As Integer
Dim intChangeQuan As Integer
intNewQuan = Forms!ProductOrderDetails![Quantity Ordered]
intOriginalQuan = Forms!ProductOrderDetails![Quantity Ordered].OldValue [here is where it breaks]
intChangeQuan = intNewQuan - intOriginalQuan
strFilter = "[Product ID] = " & Me![Product ID]
intNumInStock = DLookup("[Number in Stock]", "ProductsList", strFilter)
Me![Shipping Weight] = DLookup("[Shipping Weight]", "ProductsList", strFilter) * Me![Quantity Ordered]
Me![ExtendedPrice] = Price * [Quantity Ordered]
If intNumInStock >= intNewQuan Then
Me![Number in Stock] = [Number in Stock] - [intChangeQuan]
MsgBox "In Stock - " & intChangeQuan & " deducted from Inventory", vbOKOnly, "Stock Checker"
Exit Sub
Else
MsgBox "Out of Stock - Cannot take this order", vbOKOnly, "Stock Checker"
'Me![quantity ordered] = intOriginalQuan
'DoCmd.CancelEvent
Exit Sub

End If
Refresh
End Sub
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:29
Joined
Feb 19, 2002
Messages
42,981
Are you using the forms! reference rather than me! because you are referring to a control on another form? If that is the case, you may not have access to the OldValue property outside of the active form.
 

Karl K

Registered User.
Local time
Today, 01:29
Joined
Feb 2, 2000
Messages
41
No, that doesn't do it. I've tried it with Me!, alone, no change. The strange thing is, when I type a period after the field name, it should give me a long list of things to choose from, (such as OldValue) but all it gives is Value. This is my first project after installing 2000 and perhaps something isn't installed correctly. Any suggestions?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:29
Joined
Feb 19, 2002
Messages
42,981
If these are unbound fields, they won't have an OldValue property.
 

Karl K

Registered User.
Local time
Today, 01:29
Joined
Feb 2, 2000
Messages
41
No, they are bounded. I think it is a problem with the way the Access 2000 is installed. I am going to have to uninstall it and reinstall it and try it all over again. I also have 97 up and runnable, and there may be some conflict over libraries available or something.
-Thanks for your replies!
 

Karl K

Registered User.
Local time
Today, 01:29
Joined
Feb 2, 2000
Messages
41
I solved it myself! OldValue can only be connected with the name of the control, not the name of the variable! (the two were slightly different in this case to allow a shortened version to appear on the datasheet view of the form) I am a happy man. Thanks again for your replies.
 

Users who are viewing this thread

Top Bottom