J
jgrout
I'm just learning how to use VB to write code for Access 97 and am in the
middle of writing a simple event procedure to update a couple fields. I
decided to use the Set command to reference the control objects, as I have to
refer to the ones I am updating multiple times in my code. The problem is,
it works great for one of the control objects but doesn't work at all for the
other one! If I refer directly to the control object, the value is updated
no problem. Here's my code that doesn't work vs. code that does work:
DOESN'T WORK
Dim VC, Sell As Control
Set VC = Forms![Order Log]![Vendor Cost]
Set Sell = Forms![Order Log]![Revenue]
If PriceChoice = 1 Then
' this line doesn't work if I use "VC" but works fine if I use "Forms![Order
Log]![Vendor Cost]" instead of VC:
VC = VendorCost1
' this line works fine!
Sell = Price1
middle of writing a simple event procedure to update a couple fields. I
decided to use the Set command to reference the control objects, as I have to
refer to the ones I am updating multiple times in my code. The problem is,
it works great for one of the control objects but doesn't work at all for the
other one! If I refer directly to the control object, the value is updated
no problem. Here's my code that doesn't work vs. code that does work:
DOESN'T WORK
Dim VC, Sell As Control
Set VC = Forms![Order Log]![Vendor Cost]
Set Sell = Forms![Order Log]![Revenue]
If PriceChoice = 1 Then
' this line doesn't work if I use "VC" but works fine if I use "Forms![Order
Log]![Vendor Cost]" instead of VC:
VC = VendorCost1
' this line works fine!
Sell = Price1