Solved

Crystal Reports Accept Multiple Parameters

Posted on 2011-02-11
3
1,830 Views
Last Modified: 2013-12-26
I have a report where I use a command to grab fields and there is a parameter that should be able to accept multiple inputs, however, when I run the report with multiple I get the following error:

Failed to retrieve data from the database
Details: ADO Error code 0x80040e14
Source: Microsoft OLE DB Provider for SQL Server
Description: Incorrect Syntax near ','.
SQL State: 42000
Native Error: 102 [Database Vendor Code : 102]

The query I have is below - the ASSIGNED_TO  is the problem.  The parameter has the box checked to allow multiple values - I'm not sure what the issue is here.


select nxstar_e.tar_num, (select nxsnotes.description from nxsnotes where id = nxstar_e.tar_num and nxsnotes.type = '1stcontact') as notedes, nxstar_e.assigned_to, nxstar_e.tar_status, nxstar_e.entered_date, nxstar_e.description, nxstar_e.bus_name
from nxstar_e where nxstar_e.entered_date >= {?EntryDate}
and nxstar_e.entered_date < DATEADD("d",1,{?EntryDate})
and nxstar_e.tar_status <> 'CLOSED'
and nxstar_e.assigned_to in ({?ASSIGNED_TO})

Open in new window

0
Comment
Question by:rondre
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 34874246
Are you running a command or is that a view in the database?

ry the last line as

and nxstar_e.assigned_to in {?ASSIGNED_TO}

mlmcc
0
 

Author Closing Comment

by:rondre
ID: 34874314
I am running a command - I thought I'd already tried that but I must have been wrong as that worked - thanks for the help and sorry to have wasted time :)
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 34874328
Two things:

1)  Quotes around the "d" in the dateadd function.  Double quotes denote a field name, which it isn't.  You're using Crystal syntax, not SQL syntax.

2)  You don't need the parentheses around the {?ASSIGNED_TO} parameter

Try the following code sample.

~Kurt

 
select
  nxstar_e.tar_num,
  (
  select
    nxsnotes.description
  from
    nxsnotes
  where
    id = nxstar_e.tar_num
    and nxsnotes.type = '1stcontact'
  ) as notedes,
  nxstar_e.assigned_to,
  nxstar_e.tar_status,
  nxstar_e.entered_date,
  nxstar_e.description,
  nxstar_e.bus_name
from
  nxstar_e
where
  nxstar_e.entered_date >= {?EntryDate}
  and nxstar_e.entered_date < DATEADD(day,1,{?EntryDate})
  and nxstar_e.tar_status <> 'CLOSED'
  and nxstar_e.assigned_to in {?ASSIGNED_TO}

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now