|
-
Jun 5th, 2006, 11:08 PM
#1
Thread Starter
New Member
Passing parameter from VB to CR
Below is my code
My problem is that give me an error about getitembyname saying that "method or data member not found"
any ideas???
Code:
Dim strsql As String
Set rsconn = New ADODB.Recordset
OpenDB
strsql = "SELECT * FROM " & _
"MASTER_MO WHERE MASTER_MO.SHIP_DATE=#" & frmShipping.cmbShipDate.Text & "# " & _
"AND MASTER_MO.PO='" & frmShipping.txtPoNo.Text & "'"
Debug.Print strsql
rsconn.Open strsql, con, adOpenDynamic, adLockOptimistic, adCmdText
Set CrAppl = New CRAXDRT.Application
Set CrRep = CrAppl.OpenReport(App.Path & "\RptShipping1.rpt")
CrRep.FormulaFields.GetItemByName("Container").Text = "'" & Trim(frmShipping.txtContainer.Text) & "'"
CrRep.DiscardSavedData
CrRep.Database.Tables(1).SetDataSource rsconn, 3
CRViewer1.ReportSource = CrRep
CRViewer1.EnableSearchExpertButton = True
CRViewer1.DisplayGroupTree = False
CRViewer1.EnableCloseButton = True
CRViewer1.EnableZoomControl = True
CRViewer1.DisplayToolbar = True
CRViewer1.ViewReport
Do While CRViewer1.IsBusy
DoEvents
Loop
CRViewer1.Zoom 94
Set rsconn = Nothing
CloseDB
-
Jun 6th, 2006, 01:42 AM
#2
Hyperactive Member
Re: Passing parameter from VB to CR
if u are getting error in the following place
CrRep.FormulaFields.GetItemByName("Container").Text = "'" & Trim(frmShipping.txtContainer.Text) & "'"
it may be the problem with the object Container. it may not have the porperty "Text".
-
Jun 6th, 2006, 02:05 AM
#3
Thread Starter
New Member
Re: Passing parameter from VB to CR
 Originally Posted by binilmb
if u are getting error in the following place
CrRep.FormulaFields.GetItemByName("Container").Text = "'" & Trim(frmShipping.txtContainer.Text) & "'"
it may be the problem with the object Container. it may not have the porperty "Text".
I have remove the text property but it still gave the same error and highlight in GetItemByName.
Is it needed to activate some reference or else???
-
Jun 6th, 2006, 06:59 AM
#4
Re: Passing parameter from VB to CR
Moved to reporting section
-
Jun 6th, 2006, 07:43 AM
#5
Lively Member
Re: Passing parameter from VB to CR
 Originally Posted by joseph.goh
I have remove the text property but it still gave the same error and highlight in GetItemByName.
Is it needed to activate some reference or else???
Is the parameter in CR a string? If it isn't, make it a string.
Is the parameter named spelled correctly including case?
Try this:
.GetItemByName("Container").AddCurrentValue Trim(frmShipping.txtContainer.Text)
Energy can be neither created not destroyed. It can only be wasted.
Red Green
-
Jun 6th, 2006, 09:16 PM
#6
Thread Starter
New Member
Re: Passing parameter from VB to CR
 Originally Posted by King_George
Is the parameter in CR a string? If it isn't, make it a string.
Is the parameter named spelled correctly including case?
Try this:
.GetItemByName("Container").AddCurrentValue Trim(frmShipping.txtContainer.Text)

The value is string and the parameter name is correct
i have change to what u have suggest but when i try to run, it still gave me the error "method or data member not found" and GetItemByName is highlighted
I think vb cannot get that method, because after i type formulafields. it just prompt out add, count, delete but there is nothing about GetItemByName.
Any ideas ??
-
Jun 7th, 2006, 08:49 AM
#7
Lively Member
Re: Passing parameter from VB to CR
 Originally Posted by joseph.goh
The value is string and the parameter name is correct
i have change to what u have suggest but when i try to run, it still gave me the error "method or data member not found" and GetItemByName is highlighted
I think vb cannot get that method, because after i type formulafields. it just prompt out add, count, delete but there is nothing about GetItemByName.
Any ideas ??
Sorry I misread the post. You cannot assign formula field values from VB. You can however assign values to parameter fields.
Report.ParameterFields.GetItemByName("parameter_name").AddCurrentValue value_to_add
In your report, just use that parameter in the formula assuming that this is what you want the value for..
Energy can be neither created not destroyed. It can only be wasted.
Red Green
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
|