Solved

Crystal Reports & VB6 - Retrieving SQLQueryString property

Posted on 2004-09-29
9
591 Views
Last Modified: 2012-08-14
We are trying to retrieve the SQLQueryString from a report and getting an emptystring.
When stepping through in code it works fine and puts the string into a variable but in compiled app it fails to retrieve value.

Any ideas (or maybe a better question)

Ray
0
Comment
Question by:rfoconnor
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12182531
Is there a reason to retrieve the string?

What code are you using to retrieve the string?

mlmcc
0
 
LVL 13

Expert Comment

by:vidru
ID: 12182535
Can you post the code you're using?  Also, your version of Crystal, DB, and connectivity would be helpful.

I just ran a quick test using an ODBC connection to the CR Extreme sample db using CR8.5/VB6/RDC, and was able to successfully retreive the SQLQueryString from the report.  I did notice that when I was trying to access the SQLQueryString property, it would invoke the parameter window.

For example, this would invoke the parameter window once:
  Set rpt = cApp.OpenReport("c:\regions.rpt")
  strQry = rpt.SQLQueryString
  CRViewer1.ReportSource = rpt
  CRViewer1.ViewReport

This will cause the parameter to be invoked twice, but if two different values are entered, the report will reflect the first (invoked from ViewReport), but the SQLQueryString will reflect the second:
  Set rpt = cApp.OpenReport("c:\regions.rpt")
  CRViewer1.ReportSource = rpt
  CRViewer1.ViewReport
  strQry = rpt.SQLQueryString

-dave
0
 

Author Comment

by:rfoconnor
ID: 12191632
retrieving the string to modify it.

code as follows
'==========================================
sTableName = objCRTable.Location
if sTableName = "" then
    ' do error stuff and exit
end if

sSQL = objCRRpt.SQLQueryString
if sSQL = "" then
    ' do error stuff and exit
end if

' code to replace the tablename with the name of a CSV file generated from a query earlier
'==========================================

The problem occurs with line
sSQL = objCRRpt.SQLQueryString

When running the compiled object and occaisionally when running in debug sSQL is empty.
When stepping through the code more slowly it is populated properly every time.

Almost as if "objCRRpt.SQLQueryString" is running asynchronously



0
 
LVL 42

Expert Comment

by:frodoman
ID: 12192294
Could be waiting for a response to build the SQL.  Have you tried simply putting a small "wait" or "sleep" in front of this line of code?
0
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.

 

Author Comment

by:rfoconnor
ID: 12193901
We considered this but don't feel keen on putting in a "sleep" or similar with no way of knowing when the property has been returned.  May have to though.
0
 

Author Comment

by:rfoconnor
ID: 12274588
Did try putting a wait loop in but to no avail.

The problem seems to be opening the template.  Sometimes it works and sometimes it doesn't.
0
 

Author Comment

by:rfoconnor
ID: 12537525
Hi there

I found the answer by completely taking down Crystal Reports and re-installing it.

ALl I can think of is that there was a rogue DLL from an older version hanging around
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12572823
PAQed with points refunded (500)

modulo
Community Support Moderator
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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

919 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

13 Experts available now in Live!

Get 1:1 Help Now