Adding an Item using QSRules

Jan 19, 2006 2 Replies

I am having an issue with adding an item using QSRules and was wondering if anyone had any suggestions (code) to help: I am trying to add item #11200 with a qty of 4 using the following code:



Public Function Process(Session As SessionClass) As Boolean Dim objAdded As Object Dim id As Long Dim ilc As String Dim qty As Double qty = 4 ilc = 11200 objAdded = Session.Transaction.Entries.Add(id, ilc, qty, 0, Fales, 0) Process = True End Function



I am utilizing the AddItem hook to execute the above and I get the "Object variable or With block variable not set" on the objAdded statement. Can anyone give me some suggestions to try (in code would be greatly appreciated). Thanks,


I don't know if this a typo but you have fales instead of False. Also it looks like you are using VB6, when setting you object objAdded your code should read: Set objAdded = Session.Transaction.Entries.Add(id, ilc, qty, 0, Fales, 0) Lastly you have forgotten to set id equal to anything.

Rob

"rshuptr> I am having an issue with adding an item using QSRules and was wondering if

Rob, Thanks for the reply. I did add the id and the typo was only in this post. I also added "Set" and it worked. Now i also have a question in that the only place i can put the additem stated is in the class, is that correct? I am also trying to use the remove method for removing an item and i can't seem to get the correct syntax. Could you possibly know how to use the remove method? 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