Solved

Crystal Reports Accept Multiple Parameters

Posted on 2011-02-11
3
1,812 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

8 Experts available now in Live!

Get 1:1 Help Now