need to use the PerformAddItem fireevent within a VB6 add-in?

I have an add-in that brings up a userform in RMS - the userform prompts the user to select some options, and then based on what they selected for options, it populates a combobox with certain itemlookupcodes. this part works fine so far. the combobox populates with the correct data just as it's supposed to. now what i need to do is take whatever itemlookup code the user has selected in the combobox, and add that as a new entry to the transaction when they press ok on the userform. this is what i have right now for my command button click event:

Private Sub cmdOK_Click() If cboPlans.Column(0) = "" Then MsgBox "Input Required!" cboPlans.SetFocus Else glbPlanID = cboPlans.Column(0) glbItemID = cboPlans.Column(1) frmPlans.Hide End If End Sub

glbPlanID is my ItemLookupCode and glbItemID is my Item ID. and in my class module contains this piece of code:

If glbDeptID = 8 Or glbDeptID = 19 Then glbPlanID = "" frmPlans.Show 1 If glbPlanID "" Then PerformAddItem glbItemID, glbPlanID, 1, 0, 0, 0, 0 End If End If

i must not be going about this the right way because my item is not getting added to the transaction. how can i trigger the performadditem fireevent from within my code when I close the userform, and have it add an item using the glbPlanID and glbItemID variables I have declared in the code?

thanks, Kevin

Reply to
kskinne
Loading thread data ...

You can only get to QSBridge FireEvents from an HTML Add-in.

Reply to
Glenn Adams [MVP - Retail Mgmt]

Thanks Glenn - i was looking at an example in the knowledge base on customersource, and see that now... since i cannot do that, there's got to be some way of doing this through qsrules - is there something i can use via my code in VB to accomplish this?

"Glenn Adams [MVP - Retail Mgmt]" wrote:

Reply to
kskinne

you can add an item to the TransactionEntries Collection, but this does not activate ANY of the business logic that PerformAddItem would- for instance, it will not check for price levels or sale price. I would try to change your business process rather than try to code to it if you can - there's a lot of logic to replicate to add items from code...

Good Luck!

Reply to
Glenn Adams [MVP - Retail Mgmt]

for these particular items that need to be added, they are noninventoried items with no change to price needed. i simply need to add the item's lookup code to the transaction, leaving all of the item information that would get returned at its default setting. so if it skips the business logic and just returns the lookup code, description quantity and default price, that's fine. what is the correct syntax for using this method, i can't seem to find any detailed documentation on this method and it's arguments

thanks, kevin

Reply to
kskinne

this is an example of my 'PerformAddItem' procedure developed for test..

Public Function Process(obj As Object) As Boolean code(0) = "8000333553169" code(1) = "8000349143163" code(2) = "7704A02"

Dim rules As QSRules.Session

Set rules = obj

Dim rstItem, rstAlias As ADODB.Recordset

Dim strAlias, strQuery As String

Dim i As Integer

For i = 0 To 347

strQuery = "SELECT [ID] FROM [Item] WHERE [ItemLookupCode] = '" & code(i) & "';" strAlias = "SELECT [ItemID] FROM [Alias] WHERE [Alias].[Alias] = '" & code(i) & "';"

Set rstItem = rules.Database.OpenRecordset(strQuery, True) Set rstAlias = rules.Database.OpenRecordset(strAlias, True)

If Not (rstItem.BOF And rstItem.EOF) Then Call rules.Transaction.Entries.Add(0, code(i), CDbl(1), 0, False, 0) PerformAddItem = True ElseIf Not (rstAlias.BOF And rstAlias.EOF) Then Call rules.Transaction.Entries.Add(0, code(i), CDbl(1), 0, False, 0) PerformAddItem = True Else PerformAddItem = False End If

rstItem.Close rstAlias.Close Set rstItem = Nothing Set rstAlias = Nothing Next i

Exit Function

End Function

Reply to
Antonio Mazzeo

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.