Connecting Tech Pros Worldwide Forums | Help | Site Map

problem with Datareport please help me iam final stage in my project

Newbie
 
Join Date: Mar 2007
Posts: 21
#1: Apr 26 '07
hi this is pramod i am facing a small problem
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command_Click()
  2. Dim a As String
  3.  
  4. a = InputBox("enter empno")
  5.  
  6. If rs.State = 1 Then rs.Close
  7.  
  8. rs.Open "select * from microbiology Where bat_num = " & a, cn, adOpenForwardOnly, adLockReadOnly
  9.  
  10. LinkDataReport1
  11.  
  12. end sub
  13.  
  14. Public Sub LinkDataReport1()
  15.  
  16. With DataReport2
  17.  
  18.     'We must set The DataReport source to nothing!
  19.     'Else DataReport wants to use its own Source
  20.     Set .DataSource = Nothing
  21.     .DataMember = ""
  22.  
  23.         'We Connect the DataReport to our Recordset Since
  24.         'we disallowed DataReport1 to use its own above
  25.         Set .DataSource = rs
  26.  
  27.         'Here we are 'Hard Coding the textboxs to the fields
  28.         With .Sections("Section1").Controls
  29.             .Item(1).DataMember = ""
  30.             .Item(1).DataField = rs.Fields(0).Name
  31.             .Item(2).DataMember = ""
  32.             .Item(2).DataField = rs.Fields(1).Name
  33.             .Item(3).DataMember = ""
  34.             .Item(3).DataField = rs.Fields(2).Name
  35.             .Item(4).DataMember = ""
  36.             .Item(4).DataField = rs.Fields(3).Name
  37.             .Item(5).DataMember = ""
  38.             .Item(5).DataField = rs.Fields(4).Name
  39.        End With
  40.  
  41.     .Show
  42.  
  43. End With
  44.  
  45. End Sub
In the above code i am getting a RUNTIME Error i.e

Object does not support this property or method

while in the above code when iam using with datareport1 i am not getting error
what is the problem i am not able to understand please help if any can
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#2: Apr 26 '07

re: problem with Datareport please help me iam final stage in my project


Do you know which line produces the error?
Newbie
 
Join Date: Mar 2007
Posts: 21
#3: Apr 28 '07

re: problem with Datareport please help me iam final stage in my project


Quote:

Originally Posted by Killer42

Do you know which line produces the error?


.Item(1).DataMember = ""
.Item(1).DataField = rs.Fields(0).Name

error: object doesn't support this property or method
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#4: Apr 29 '07

re: problem with Datareport please help me iam final stage in my project


Quote:

Originally Posted by pramodrepaka

.Item(1).DataMember = ""
.Item(1).DataField = rs.Fields(0).Name

error: object doesn't support this property or method

Hey there, pramodrepaka!

Looks like you dimensioned a, but you did not do the same for rs. Your problem may be more specific. Also, run your code in debug mode to see what it is doing:

(1) Choose Debug
(2) Step Into
(3) Hit F8 until you each the error pop up

I will plug in your code see what it does here...
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#5: Apr 29 '07

re: problem with Datareport please help me iam final stage in my project


Quote:

Originally Posted by pramodrepaka

.Item(1).DataMember = ""
.Item(1).DataField = rs.Fields(0).Name

error: object doesn't support this property or method

Hey there, pramodrepaka!

Looks like you dimensioned a, but you did not do the same for rs. Your problem may be more specific. Also, run your code in debug mode to see what it is doing:

(1) Choose Debug
(2) Step Into
(3) Hit F8 until you each the error pop up

I will plug in your code see what it does here...
Newbie
 
Join Date: Mar 2007
Posts: 21
#6: May 4 '07

re: problem with Datareport please help me iam final stage in my project


hey
i tried what u said but i am not able to solve the problem i,e the error is
.Item(1).DataMember = ""
.Item(1).DataField = rs.Fields(0).Name


the error number is 438
and the error message is
object doesn't support this prorperty or method
what 2 do i am not able 2 understand plz help me
Quote:

Originally Posted by Dököll

Hey there, pramodrepaka!

Looks like you dimensioned a, but you did not do the same for rs. Your problem may be more specific. Also, run your code in debug mode to see what it is doing:

(1) Choose Debug
(2) Step Into
(3) Hit F8 until you each the error pop up

I will plug in your code see what it does here...

Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#7: May 4 '07

re: problem with Datareport please help me iam final stage in my project


Quote:

Originally Posted by pramodrepaka

.Item(1).DataMember = ""
.Item(1).DataField = rs.Fields(0).Name

There are two lines there. We still don't know which one produces the error. Which also means that we don't know whether the error refers to .Item(1) or rs.Fields(0).

You need to be more specific.
Reply