Capturing the ItemID from the Add function.

Can anyone tell me how to capture the ItemID (referenced by the Add function): Dim objAdded As Object set objAdded = Session.Transaction.Entries.Add(ItemID, ItemLookUpCode, Qty,

0, False, 0).

I tried the following and am getting an error: Dim itemid as Long itemid = Session.Transaction.Entries.Element(entrynumber).Item.ID

The itemID referenced in the add function seems to be the itemID from the database and not the entry ID on the pos screen.

Thanks, Robert

Reply to
rshuptrine
Loading thread data ...

You can do a query on the Database using the ItemLookupCode. Use the code I posted a couple of days ago then do a query for the Item.ID.

Public Function Process(mySession As Object) As Boolean Dim ikey As Integer Dim ilc As String Dim id As Long ikey = mySession.Transaction.Entries.Count If ikey 0 Then ' Assign ilc = the last item added to the transaction ilc mySession.Transaction.Entries.Element(ikey).Item.ItemLookupCode Set rs = mySession.OpenRecordset("SELECT ID FROM Item WHERE ItemLookupCode = '" & ilc & "'", False) id = rs.Fields("ID").Value MsgBox ilc & " " & id Else ' Quit function if item was not found in database Process = False End If End Function

Rob

Reply to
Rob

Reply to
Wilfredo De Jesus

Thanks for the reply, however the rs is not defined. How would you define rs? Getting variable not defined? Thanks, Robert

Reply to
rshuptrine

rs is the recordset, add the line below and a reference to Microsoft ActiveX Data Object. Dim rs As New ADODB.Recordset

Rob

Reply to
Rob

Rob, That worked, however now i am getting an EOF or BOF error. It tells me that either of these = True when i try to add any item on the pos screen. Any ideas? Thanks, Robert

Reply to
rshuptrine

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.