Hi all,
I have having a problem with the dLookup() function in MS Access 2003 (saved database as Access 2000).
I am fairly new to the VB aspect of access. I am familiar with Lingo (years ago), HTML, PHP, and MySQL. For some reason i find it very hard to go from HTML/PHP/MySQL to Access. I guess i just got used to a very linear display, submit, redisplay method. Anyway, this is my attempt at making a subform for an RMA that displays the price of an item once that item is selected from a combo list. The price is stored in a table called "Items" and it is the third column (if that matters)called "Price". The unique key for the table is "ItemNum". so i put this code in the after update event procedure for the combo box with the Item Num.
Here is my code
I have having a problem with the dLookup() function in MS Access 2003 (saved database as Access 2000).
I am fairly new to the VB aspect of access. I am familiar with Lingo (years ago), HTML, PHP, and MySQL. For some reason i find it very hard to go from HTML/PHP/MySQL to Access. I guess i just got used to a very linear display, submit, redisplay method. Anyway, this is my attempt at making a subform for an RMA that displays the price of an item once that item is selected from a combo list. The price is stored in a table called "Items" and it is the third column (if that matters)called "Price". The unique key for the table is "ItemNum". so i put this code in the after update event procedure for the combo box with the Item Num.
Here is my code
Code:
Option Compare Database
Private Sub ItemNum_AfterUpdate()
Dim strFilter As String
Dim strResult As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ItemNum = " & Me!ItemNum
' Look up product's unit price and assign it to Price control.
strResult = DLookup("Price", "Items", strFilter)
Me!Price = strResult
Exit_ProductID_AfterUpdate:
Exit Sub
End Sub
[\code]
I recieve this error
"runtime error '2001'
you canceled the previous operation