What's wrong with these VB codes
What's wrong with these VB codes
(OP)
Hi
I'm trying to write a simple VB form with an AccpacDataSource, an AccpacFieldEditControl and an AccpacViewList. In design mode, everything is ok. I can set a ViewID to the AccpacDataSource (GL0001 for example) link the FieldEdit and ViewList to the datasource etc.
However, at run time, I can not Set the AccpacDataSource.Active to True.... It always report an error "Method Active of object IAccpacDataSource failed".
Before setting the Active Property, I have these codes:
Dim mySession as new AccpacCOMAPI.AccpacSession
dim mySignonManager as New AccpacSignonManager.AccpacSignonMgr
mySession.Init "", "CS", "CS0001", "5.0"
mySignonManager.Signon mySession
adsGL0001.Session=mySession
adsGL0001.Active=True
(adsGL0001 is the name of my AccpacDataSource control)
If you could please point out what might be wrong with the code and/or provide me with a source of a small VB program with those control and can open any view using sample company, I would very much appreciate it.
Thank you very much
I'm trying to write a simple VB form with an AccpacDataSource, an AccpacFieldEditControl and an AccpacViewList. In design mode, everything is ok. I can set a ViewID to the AccpacDataSource (GL0001 for example) link the FieldEdit and ViewList to the datasource etc.
However, at run time, I can not Set the AccpacDataSource.Active to True.... It always report an error "Method Active of object IAccpacDataSource failed".
Before setting the Active Property, I have these codes:
Dim mySession as new AccpacCOMAPI.AccpacSession
dim mySignonManager as New AccpacSignonManager.AccpacSignonMgr
mySession.Init "", "CS", "CS0001", "5.0"
mySignonManager.Signon mySession
adsGL0001.Session=mySession
adsGL0001.Active=True
(adsGL0001 is the name of my AccpacDataSource control)
If you could please point out what might be wrong with the code and/or provide me with a source of a small VB program with those control and can open any view using sample company, I would very much appreciate it.
Thank you very much
RE: What's wrong with these VB codes
The only error i have counted in the above code is the application version does not match the activated data of company database.
You should init the session like this and then tell me
mySession.Init "", "CS", "CS0001", "50A"
It will solve your problem. Any other problem in ACCPAC customization if you are facing, you can contact me on ilyasanjum@hotmail.com. I will try to solve your problem.
Anjum
RE: What's wrong with these VB codes
Actually later after posting this, I found it out myself. Yeah, I was indeed wrong in the session.Init. There seemed to be no documents or examples about how the last parameter should be. Only until I disassembled one of Accpac file and found that it should be like "50A" instead of "5.0"
Thank you very much for your solution and your offer for future help. I've saved your email to my address book and will sure contact you should I have any problem with Accpac customization.
Wish you health and success