Subject: Error 2001 You canceled the previous operation
Posted By: RayL Post Date: 11/30/2006 11:02:54 AM
I have done similar stuff a zillion times and when I get this error it usually means I've misspelled something. The following code produces the error.

Private Sub UnitsOrdered_AfterUpdate()
Dim vID As Integer
vID = Me![ProductID]

Me![UnitPrice] = DLookup("[UnitPrice]", "Products", "[ProductID] = vID")

End Sub
If I plug in Me![ProductID] for vID, I also get the error.
If I plug in an actual ID number, such as 1002, it works.

Anyone have any ideas.

Thanks,
Ray

Reply By: RuralGuy Reply Date: 12/2/2006 11:42:46 AM
Try:
Me![UnitPrice] = DLookup("[UnitPrice]", "Products", "[ProductID] =" &  vID )


HTH RuralGuy (RG for short) acXP WinXP Pro
Reply By: SerranoG Reply Date: 12/5/2006 8:17:04 AM
Me.UnitPrice = Nz(DLookup("[UnitPrice]", "Products", "[ProductID] = " & Me.vID), 0)

If vID is a number, or

Me.UnitPrice = Nz(DLookup("[UnitPrice]", "Products", "[ProductID] = '" & Me.vID & "'"), 0)

if vID is a string.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply By: RayL Reply Date: 12/8/2006 2:00:35 PM
RG & Greg ..... Thanks for the help. Problem solved.

Ray


Go to topic 25518

Return to index page 98
Return to index page 97
Return to index page 96
Return to index page 95
Return to index page 94
Return to index page 93
Return to index page 92
Return to index page 91
Return to index page 90
Return to index page 89