Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,450 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,084 people online right now. Registration is fast and FREE... Join Now!




VB6, Crystal Reports 6 or 7, SqlQuery

 
Reply to this topicStart new topic

VB6, Crystal Reports 6 or 7, SqlQuery, Consecutive Blanks deleted from String in SqlQuery

gklocek
29 Jul, 2008 - 02:25 PM
Post #1

New D.I.C Head
*

Joined: 29 Jul, 2008
Posts: 1

I am having problems with an older application designed in VB6 that uses Crystal Reports V6 and V7. When I pass a SQL Query command to Crystal Reports OCX v6 or v7 like this (where 'b' is a Blank Space) ...

CODE

...
objCrystalReport.SqlQuery = "SELECT * FROM tblPartMaster WHERE PartNum = '1b2bb3bbb4bbbb'"
...


What actually makes it to Crystal Reports is this ...

CODE

  SELECT * FROM tblPartMaster WHERE PartNum = '1b2b3b4b'



The Crystal Report OCX is stripping excess consecutive SPACES from the entire SQL Query Command. That is great except it should not be stripping any consecutive spaces from inside the SINGLE QUOTED STRING LITERAL. This makes the WHERE Clause fail only for certain new Part Numbers that now have consecutive spaces in them. The PartNum is actually appended to the VB6 String just before the Crystal Report is activated but was shown here as a constant just for clarity purposes. The Crystal Report works perfectly if there are not consecutive spaces in the Part Number but it selects no Part Number if there are consecutives spaces in the Part Number.

Is this a known bug?
Is there Crystal Setting that I can change to fix this?

Thank You,

This post has been edited by gklocek: 29 Jul, 2008 - 02:59 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 02:59PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month