Getting Cashier ID as 0

I am getting cashier Id as 0 everytime ?? I am trying to display the Cashier Id on message box and everytime its displaying 0

Following is the code that I have used... It always goes to Else condition and displays 0....

Hook Type was 2 i.e TenderBegin

Public Function Process(Optional mySession As Object) As Boolean Set mySession = CreateObject("QSRules.SessionClass") If mySession.Cashier.ID = 1 Then MsgBox (mySession.Cashier.FirstName) Else MsgBox ("Id is not know" & mySession.Cashier.ID) End If End Function

Please Help me... Waiting for ur reply... :-(

Vicky...:-)

Reply to
Vicky
Loading thread data ...

Try getting rid of the line that obliterates the session object that is passed into your function:-

Public Function Process(mySession As Object) As Boolean If mySession.Cashier.ID = 1 Then MsgBox (mySession.Cashier.FirstName) Else MsgBox ("Id is not know" & mySession.Cashier.ID) End If End Function

If you want to save a reference to the session object for use elsewhere, try:-

'Dim g_objSession as Object 'Comment this line for debug Dim g_objSession as QSRules.SessionClass ' Comment this line for release

Public Function Process(mySession As Object) As Boolean Set g_objSession = mySession

If g_objSession.Cashier.ID = 1 Then MsgBox (g_objSession.Cashier.FirstName) Else MsgBox ("Id is not know" & g_objSession.Cashier.ID) End If End Function

Reply to
RSB

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.