Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Crystal Reports & SQL Server

Posted on 1998-10-04
Medium Priority
Last Modified: 2013-12-25
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
Question by:palim
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2

Expert Comment

ID: 1487323
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!

Expert Comment

ID: 1487324
instead of using
try using

this works. there are some instabilities with the method Action
PrintReport method should work after you set the
ReportFileName parameter.


Author Comment

ID: 1487325
I've tried what you suggested but it doesn't seem to be working...  Nothing happens after I pass the control.printreport statement. Thanks!
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1487326

   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


Expert Comment

ID: 1487327
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

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


Expert Comment

ID: 1487328
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.


Author Comment

ID: 1487329
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.

Expert Comment

ID: 1487330
Have you tried using connect instead of logonserver

Author Comment

ID: 1487331
Yeah.. I actually tried connect just now and it works already.  Anyway, the points are yours.

Accepted Solution

Veroland earned 20 total points
ID: 1487332
Cool, wil submit it as awnser then

CrystalReport1.Connect = "FileDSN = \\Applsvr1\Timesheets\TimesheetV6Configs\TimesheetV6ODBC.dsn;UID = TimeUser;PWD = password;DSQ = TimesheetV6"

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question