Store Ops Business Rules

When creating an application in VB6, how can I make the SessionClass object available to Forms and other Classes.

John

Reply to
John
Loading thread data ...

Are you talking about a 'live' SessionClass passed into your application via a Process() function called from a Custom POS button or a Hook Event? If so, just pass the Session around as a By Ref parameter, or create a Set Property in your form/class module to set a reference to the SessionClass just after you instantiate your object.

If you are looking to have an external application create it's own Session, there are several things you have to do. There has been sample code posted to this newsgroup in the past, but I think it's a little short of fully functional. Search for ConnectionInfo and you should find some of the posts. There is no documentation on using the SessionClass in this way as far as I know...

Below is some code that will get you a SessionClass that is connected to an RMS database. I never pursued this any farther, but I believe there are some additional properties on the SessionClass itself that need to be set before it becomes fully functional - with this much connection, the Data functions in the Gateway class should work though...

'This code was in a Form Module...

Private m_QSRules As QSRules.SessionClass

Private Sub brnConnect_Click() Dim CI As New QSRules.ConnectionInfo

With CI .ApplicationMode = applicationmodeQSC .ConnectTimeout = 15 .DataSource = "(local)" .InitialCatalog = "RMSSample" .Password = "password" .UserID = "sa" .RegisterNumber = 1 .Provider = "SQLOLEDB" End With

MsgBox "Connected?=" & m_QSRules.Database.OpenConnection(CI, False)

MsgBox m_QSRules.Database.OpenRecordset("Select getdate()", True).Fields(0) End Sub

Private Sub Form_Load()

Set m_QSRules = New QSRules.SessionClass

End Sub

Reply to
Glenn Adams [MVP - Retail Mgmt]

I am talking about a 'live' SessionClass passed into my application via a Process() function called from a Custom POS button.

I copied and pasted info from your post into a Form and loaded the Form from the Process() function using Form1.Show. I get an error saying: Runtime Error: Automation error ClassFactory cannot supply requested class

Then I get a Microsoft Store Operations POS error Attempt to process COM object "Project1.Class1' failed. An unknown error occured.

Any ideas?

John

"Glenn Adams [MVP - Retail Mgmt]" wrote in message news: snipped-for-privacy@TK2MSFTNGP09.phx.gbl...

Reply to
John

The code I posted was for an independent application (.exe). You wouldn't want to call it from a Process() function...

Not sure exactly why you got the first error, but it may be because QSRules is not referenced in your project. THe second error is RMS telling you that there was an internal error in the hook function.

Public Function Process(mySession as Object) as boolean

'Do some stuff msgbox "Register Number:" & cstr(mySession.Register.Number) 'This may be an invalid property name...

'Call your sub... mySub mySession ' Calling your sub with the SessionClass as a parameter

'Do some more stuff

'return Process = true

end function

private sub mySub(theSession as Object)

'Use the session here... msgbox "Cashier: " & theSession.Cashier.Name 'This may be an invalid property - I'm doing this freehand...

end sub

Reply to
Glenn Adams [MVP - Retail Mgmt]

You talked about passing the Form a reference of the session object, how do I do that and then how could you return a result of True or False back to the class.

John

"Glenn Adams [MVP - Retail Mgmt]" wrote in message news:ur7% snipped-for-privacy@TK2MSFTNGP12.phx.gbl...

Reply to
John

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.