By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

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

P: 21
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
Apr 26 '07 #1
Share this Question
Share on Google+
6 Replies


Expert 5K+
P: 8,434
Do you know which line produces the error?
Apr 26 '07 #2

P: 21
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
Apr 28 '07 #3

Dököll
Expert 100+
P: 2,364
.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...
Apr 29 '07 #4

Dököll
Expert 100+
P: 2,364
.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...
Apr 29 '07 #5

P: 21
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
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...
May 4 '07 #6

Expert 5K+
P: 8,434
.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.
May 4 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.