7 Replies - 15507 Views - Last Post: 30 November 2009 - 01:42 PM Rate Topic: -----

#1 Snehal N  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 26-November 09

how to pass parameter to data report

Post icon  Posted 26 November 2009 - 12:28 AM

how to pass parameter to data report?
Is This A Good Question/Topic? 0
  • +

Replies To: how to pass parameter to data report

#2 bytelogik  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 212
  • Joined: 06-October 09

Re: how to pass parameter to data report

Posted 26 November 2009 - 11:06 AM

Hi,
Check out:

http://www.greenspun...l?msg_id=006055

http://support.micro...?...US;Q244779&

http://www.eggheadca...ameters-to.aspx

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#3 Snehal N  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 26-November 09

Re: how to pass parameter to data report

Posted 26 November 2009 - 09:11 PM

thank u Sir,
1st link is helpfull for me,but it is showing error "type missmatch" n i have checked data type of parameter n
data type of that particular field.
pls help me
Thanks & Regards
Snehal
Was This Post Helpful? 0
  • +
  • -

#4 bytelogik  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 212
  • Joined: 06-October 09

Re: how to pass parameter to data report

Posted 27 November 2009 - 10:13 AM

Snehal,

"Type Mismatch" errors are language specific, so absolutely can be solved. Send me the statement/s which is causing this error. What data-types are you using ? If possible briefly mention about your project.

keep smiling.
Was This Post Helpful? 0
  • +
  • -

#5 Snehal N  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 26-November 09

Re: how to pass parameter to data report

Posted 27 November 2009 - 10:31 PM

i want to pass string to data report,i m giving host data type as String, but i m confused in parameter data type,which data type should i use?

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()
DataEnvironment2.Command2 ((cmbcoursename.Text))
DataReport2.Show
End Sub

Private Sub Form_Load()
con.Open "dsn=Ad"
rs.Open "Select distinct(CourseName) from StudentMaster", con, adOpenDynamic, adLockOptimistic
rs.MoveFirst
While rs.EOF = False
	cmbcoursename.AddItem (rs.Fields(0))
rs.MoveNext
Wend
End Sub


i think the above code is correct, while running form it shows error at line ---dataenvironment2.command2((cmbcoursename.text))
Was This Post Helpful? 0
  • +
  • -

#6 bytelogik  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 212
  • Joined: 06-October 09

Re: how to pass parameter to data report

Posted 28 November 2009 - 08:45 AM

OK.

This link gives you exactly you want:
http://support.micro...kb/273821/en-us

Alternatively, if you want to pass a string to the DataEnvironment, you have to check the following things related with the Commands

1) The property "CommandType" of the Command should be set to "adCmdText"
2) The property "CommandText" can be a SQL query for eg.,
"select * from bookstable where title=?" where "?" represents one parameter to send from the input
3) In the Parameters tab, for the Command1 properties(right click the Command1 and select properties), the Name should represent the field,the Direction should be set to "Input" and an appropriate data type should be selected for the "Data Type" property.

Check out this simple example for DataEnvironment:
http://www.planet-so...p...26&lngWId=1

Another link:
http://www.andreavb....topic_6229.html


Hope this helps. Let me know if you come across any problems.

keep smiling.
Was This Post Helpful? 0
  • +
  • -

#7 Snehal N  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 26-November 09

Re: how to pass parameter to data report

Posted 30 November 2009 - 02:16 AM

thank you
i hav return sql statement as
select * from StudentMatser where CourseName =?
in Parameter tab -> parameter properties
Name- CourseName
Direction- Input
Data Type- adVarChar
Host Data type- String

n the same coding for CommandButton -> DataEnvironment1.command1 (combo1.text)
but the error occure as follows

"parameter object is improperly defined. inconsistent or incomplete information was provided"
Was This Post Helpful? 0
  • +
  • -

#8 bytelogik  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 212
  • Joined: 06-October 09

Re: how to pass parameter to data report

Posted 30 November 2009 - 01:42 PM

Hi Snehal,

It took me almost an hour to find the cause of "parameter object is improperly defined. inconsistent or incomplete information was provided" error.

In the parameter tab, there is an text box for "Size". By default there will be an value of zero. Just change it to an appropriate size e.g. 510
That is the max size for CourseName, I guess !!

This will solve your problem.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1