palim
asked on
Crystal Reports & SQL Server
I'm trying to print a report from VB using crystal Reports control and selection formulas but I get the following error when I initiate the control.action = 1
Run-time error '20536'
incorrect log on parameters
Anybody ever hit this problem
Run-time error '20536'
incorrect log on parameters
Anybody ever hit this problem
Can you show all the code you use to print the report? Especially the code where you set the properties of the Crystal control. It'll be easier to help you this way. Thanks!
instead of using
Control.action
try using
Control.PrintReport
this works. there are some instabilities with the method Action
PrintReport method should work after you set the
ReportFileName parameter.
Control.action
try using
Control.PrintReport
this works. there are some instabilities with the method Action
PrintReport method should work after you set the
ReportFileName parameter.
ASKER
I've tried what you suggested but it doesn't seem to be working... Nothing happens after I pass the control.printreport statement. Thanks!
ASKER
bergjc,
Here's the code... It's actually a very simple code and I'm testing it out if CRW will work with MSSQL.
Dim sUserID, sGroupID, strrptpath As String
strRptPath = "C:\FISS\DSS\REPORTS\"
sUserID = "PALIM123"
crptFISS.SelectionFormula = _
"({tblAuditTrail.fldUserID } = '" & sUserID & "')"
crptFISS.ReportFileName = strRptPath & "rptAuditTrail.rpt"
crptFISS.Destination = crptToWindow
crptFISS.Action = 1
PALIm
Here's the code... It's actually a very simple code and I'm testing it out if CRW will work with MSSQL.
Dim sUserID, sGroupID, strrptpath As String
strRptPath = "C:\FISS\DSS\REPORTS\"
sUserID = "PALIM123"
crptFISS.SelectionFormula = _
"({tblAuditTrail.fldUserID
crptFISS.ReportFileName = strRptPath & "rptAuditTrail.rpt"
crptFISS.Destination = crptToWindow
crptFISS.Action = 1
PALIm
Hi
I give an simple example to use crystallreport
1-create form1
2-put commandbutton on the form
3-press ctrl+T and check crystallreport4.6
4-put the crystallreport tool on the form
5-in the properties of crystallreport choose the report file name (*.rpt)
6-put these line code in the cmmandbutton1
crystallreport1.action=1
these line will print the report on the screen windows & printer
and there is more than 10 format files you can import or export
good luck
if there is any problem my e-mail
Yaco.yas@usa.net
Yaco_Hot@Hotmail.com
I give an simple example to use crystallreport
1-create form1
2-put commandbutton on the form
3-press ctrl+T and check crystallreport4.6
4-put the crystallreport tool on the form
5-in the properties of crystallreport choose the report file name (*.rpt)
6-put these line code in the cmmandbutton1
crystallreport1.action=1
these line will print the report on the screen windows & printer
and there is more than 10 format files you can import or export
good luck
if there is any problem my e-mail
Yaco.yas@usa.net
Yaco_Hot@Hotmail.com
It is apparently trying to connect to an SQL server, which I'm not positive that's what you want to do. Just in case though, in order to log on to an SQL server, you use:
crptFISS.LogonServer (dllName$, ServerName$, DatabaseName$, UserID$, Password$) <---It's in the Crystal help file
However, I'm guessing that's not what you had in mind. I would look at how you set the report up in the Crystal development environment. However you have it now is misleading it to believe that you are trying to log to a SQL server.
crptFISS.LogonServer (dllName$, ServerName$, DatabaseName$, UserID$, Password$) <---It's in the Crystal help file
However, I'm guessing that's not what you had in mind. I would look at how you set the report up in the Crystal development environment. However you have it now is misleading it to believe that you are trying to log to a SQL server.
ASKER
Hi BergJC,
It doesn't seem to work on mine. Your explanation's great but I'm now getting the error at the point of executing the LogonServer method. Anyway, I've tried what Yaco suggested and it gets through but it's not using the selection formula which is what I had in mind as I would need to pass in parameters.
Yaco, Any idea what's going wrong in my routine?
Thanks anyway, BergJC.
It doesn't seem to work on mine. Your explanation's great but I'm now getting the error at the point of executing the LogonServer method. Anyway, I've tried what Yaco suggested and it gets through but it's not using the selection formula which is what I had in mind as I would need to pass in parameters.
Yaco, Any idea what's going wrong in my routine?
Thanks anyway, BergJC.
Have you tried using connect instead of logonserver
ASKER
Yeah.. I actually tried connect just now and it works already. Anyway, the points are yours.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.