2 Replies - 5442 Views - Last Post: 26 February 2012 - 11:59 PM Rate Topic: -----

#1 cerisk360   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 18-February 12

Method or data member not found VB6 ?

Posted 18 February 2012 - 07:09 AM

Private Sub Form_Load()
Dim str As String
Set cn = Nothing
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database.mdb;Persist Security Info=False"
str = "select * from tbl_empdetail"
rs.Open str, adoconn, adOpenDynamic, adLockPessimistic
Set rs = New ADODB.Recordset
rs.MoveFirst
    txt_empid.Text = rs!EmployeeID
    txt_empname.Text = rs!Name
    txt_empadd.Text = rs!Address
    txt_empjobtitle.Text = rs!Jobtitle
    txt_empsalary.Text = rs!Salary
    txt_emplogintype.Text = rs!Logintype
    txt_empphnumber.Text = rs!Phonenumnber
    txt_empmobilenum.Text = rs!Mobilenumber
    txt_empemailadd.Text = rs!EmailAddress
End Sub




gives yellow mark around "Private Sub Form_Load()
" and highlights .text in txt_empid.[Text] = rs!EmployeeID giving "Method or data member not found" error

Is This A Good Question/Topic? 0
  • +

Replies To: Method or data member not found VB6 ?

#2 maj3091   User is offline

  • D.I.C Lover
  • member icon

Reputation: 330
  • View blog
  • Posts: 1,998
  • Joined: 26-March 09

Re: Method or data member not found VB6 ?

Posted 19 February 2012 - 12:56 AM

Is txt_empid actually a textbox on that form?
Was This Post Helpful? 0
  • +
  • -

#3 BobRodes   User is offline

  • Lovable Curmudgeon
  • member icon

Reputation: 600
  • View blog
  • Posts: 3,071
  • Joined: 19-May 09

Re: Method or data member not found VB6 ?

Posted 26 February 2012 - 11:59 PM

Probably. However, setting cn to nothing before attempting to open it doesn't help, and then referencing some connection called adoconn with the recordset.open method ain't going to cut it either.

So don't set cn to nothing, set it to a New ADODB.Connection, much as you have done with your rs variable. Then, when you open your recordset, pass it the connection you've created instead of some random variable called adoConn that you copied from somewhere else.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1