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