Capturing the ItemID from the Add function.

Jan 29, 2006 5 Replies

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


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

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

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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required