|
-
Jul 18th, 1999, 09:31 PM
#1
Thread Starter
Member
I am a newbie to Visual Basic, and I am having some trouble with the Crystal Reports control. I am not sure if I am trying to make it do something it cannot do, or if I just don't know what I'm doing. The question is this: when using the control to access a pre-made report format, can triggers in the app change the selection criteria? The code I am using is as follows:
Option Explicit
Dim Number As String
Private Sub cmdView_Click()
Dim CrystalReport1 As String
txtNumber = Number
CrystalReport1 = "c:\windows\desktop\ComponentReport.rpt"
If Option2 = True Then _
frmComponentReport.CrystalReport1.SelectionFormula = _
"{Component.ComponentNumber} = Number"
frmComponentReport.CrystalReport1.Destination = 0
frmComponentReport.CrystalReport1.Action = 1
End Sub
Private Sub cmdPrint_Click()
txtNumber = Number
Dim CrystalReport1 As String
CrystalReport1 = _
"c:\windows\desktop\ComponentReport.rpt"
If Option2 = True Then frmComponentReport.CrystalReport1.SelectionFormula _
= "{Component.ComponentNumber} = Number"
frmComponentReport.CrystalReport1.Destination = 1
frmComponentReport.CrystalReport1.Action = 1
End Sub
When the option box for a report on a single component is active, an error message appears saying "Error in fuormula <Record_Selection>. The remaining text does not appear to be part of the formula."
I have checked a half-dozen reference books and poked around on the web, but there is not a lot on the Crystal Reports control (at least not that I can find). Any help would be appreciated.
Thanks,
Jonathan
-
Jul 19th, 1999, 12:17 AM
#2
Thread Starter
Member
Preeti-
Thanks for the advice. Unforunately, I am still getting the same error message ("Error in formula <Record_Selection>. The remaining text does not appear to be part of the formula." I have four forms with identical code except for different titles, links to record sources, and links to reports (I will hopefully eventually figure out how to refine my programming so I can streamline this, but as I said I am a newbie). One of the four forms brings up a different error, which says that a number, currency amount, boolean or string is expected here where "{FireZone.Firezone} = " is (that's the name of the table and field for that form).
I am thoroughly confused. VB was going along pretty swimmingly until this came along. I understand what I did wrong before, but Preeti's code with the variable concatenation seems like it should work. And not to freak you out, but I'm working on a piece of software concerned with nuclear power plant safety and as you may have noticed I am not entirely competent. If anyone can explain what I'm doing wrong this time, I'd really appreciate it.
And Preeti, thanks again.
-Jonathan
------------------
"Black?"
"For over thirty years."
-
Jul 19th, 1999, 11:34 AM
#3
Lively Member
Hi,
Try:
= "{Component.ComponentNumber} = " & Number
Where Number is a variable and the its value is what you are passing to the report.
The way that you have it, is like saying "Select all records from Component where the component number equals number"
Unless this is what you want to say 
HTH,
Preeti
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|