4 Replies - 10364 Views - Last Post: 28 September 2009 - 02:31 AM Rate Topic: -----

#1 kakarocks   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-September 09

Compile error :method or data member not found in vb6

Post icon  Posted 27 September 2009 - 08:13 AM

hello people , my name is Ahsan and Iím giving my Igcse exam this session I have to submit this course work to them within the remaining 16 days . I am NOT asking you do it for me. I unlike most of the other decided to do it myself, I am a beginner and donít know much , all that I have reached up to now is just by using my head and nothing else . But now I have been stranded by this error:"compile error: method or data member not found " in vibe 6. I used the Microsoft jet 4.0 ... to link my access database to the form and then made the text boxes and chose the respective fields for them. Then I made the save button and wrote this code for it

Private Sub Save_Click() If txtname.Text Or txtphonenumber.Text Or txtalternatenumber.Text Or txtlocalornational.Text Or txtprovince.Text Or txtcityorprovince.Text = "" Then MsgBox "please enter a value in all fields" Else AdoEmergencynumbers.Recordset.Fields("Name of Service") = txtname.Text AdoEmergencynumbers.Recordset.Fields("Phone Number") = txtphonenumber.Text AdoEmergencynumbers.Recordset.Fields("Alternate Number") = txtalternatenumber.Text AdoEmergencynumbers.Recordset.Fields("Local or National") = txtlocalornational.Text AdoEmergencynumbers.Recordset.Fields("Province") = txtprovince.Text AdoEmergencynumbers.Recordset.Fields("name of concerning city/provice") = txtcityorprovince.Text AdoEmergencynumbers.Recordset.Update End If


But Iím getting the error I mentioned above. Please help me i really need help. I am NOT asking you to do the course work for me, I want to do it myself unlike my friend who got there teachers or cousins, friends etc to make it for them. Please people i would appreciate your help. The access data base is attached
Thank you
regards: Ahsan

Is This A Good Question/Topic? 0
  • +

Replies To: Compile error :method or data member not found in vb6

#2 CapeCAD   User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 64
  • Joined: 10-August 09

Re: Compile error :method or data member not found in vb6

Posted 27 September 2009 - 03:46 PM

First problem I see:
In your "If" statement you do not fully qualify each "Or" statement. Only tyorprovince.Text = "", the rest will not evaluate correctly.

Add ="" to each Or

If txtname.Text="" Or txtphonenumber.Text="" Or txtalternatenumber.Text="" Or _ 

Was This Post Helpful? 1
  • +
  • -

#3 kakarocks   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-September 09

Re: Compile error :method or data member not found in vb6

Posted 27 September 2009 - 07:33 PM

thanks a lot Cape CAD i really appreciate your help ^^ thank you . hmm still getting that error another interesting thing i noticed that i treid to create the save button and the delete button apparently they also give the same error and the text that becomes highlighted in them all is

.recordset.

don't know why , as i said before i am a beginner and must be making a very stupid mistake thanks for your help cape really appreciate it, but i need a little more

just a little addition hm i declared adoemergencynumbers as adodb.recordset still the error remains , did i do a right thing?

This post has been edited by kakarocks: 27 September 2009 - 07:42 PM

Was This Post Helpful? 0
  • +
  • -

#4 CapeCAD   User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 64
  • Joined: 10-August 09

Re: Compile error :method or data member not found in vb6

Posted 27 September 2009 - 09:02 PM

View Postkakarocks, on 27 Sep, 2009 - 08:33 PM, said:

thanks a lot Cape CAD i really appreciate your help ^^ thank you . hmm still getting that error another interesting thing i noticed that i treid to create the save button and the delete button apparently they also give the same error and the text that becomes highlighted in them all is

.recordset.

don't know why , as i said before i am a beginner and must be making a very stupid mistake thanks for your help cape really appreciate it, but i need a little more

just a little addition hm i declared adoemergencynumbers as adodb.recordset still the error remains , did i do a right thing?



You have to create the recordset, add the fields, open it, add new record, then you can assign the field values and update
Dim AdoEmergencynumbers As New ADODB.Recordset
Private Sub Save_Click()
		If txtname.Text = "" _
			Or txtphonenumber.Text = "" _
			Or txtalternatenumber.Text = "" _
			Or txtlocalornational.Text = "" _
			Or txtprovince.Text = "" _
			Or txtcityorprovince.Text = "" Then

			MsgBox("please enter a value in all fields")
		Else
			AdoEmergencynumbers = CreateObject("ADODB.Recordset")
			AdoEmergencynumbers.Fields.Append("Name of Service", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Fields.Append("Phone Number", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Fields.Append("Alternate Number", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Fields.Append("Local or National", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Fields.Append("Province", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Fields.Append("name of concerning city/provice", ADODB.DataTypeEnum.adVarChar, 100)
			AdoEmergencynumbers.Open()
			AdoEmergencynumbers.AddNew()
			AdoEmergencynumbers("Name of Service").Value = txtname.Text
			AdoEmergencynumbers("Phone Number").Value = txtphonenumber.Text
			AdoEmergencynumbers("Alternate Number").Value = txtalternatenumber.Text
			AdoEmergencynumbers("Local or National").Value = txtlocalornational.Text
			AdoEmergencynumbers("Province").Value = txtprovince.Text
			AdoEmergencynumbers("name of concerning city/provice").Value = txtcityorprovince.Text
			AdoEmergencynumbers.Update()
		End If
	End Sub

This post has been edited by CapeCAD: 27 September 2009 - 09:06 PM

Was This Post Helpful? 1
  • +
  • -

#5 thava   User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,607
  • Joined: 17-April 07

Re: Compile error :method or data member not found in vb6

Posted 28 September 2009 - 02:31 AM

this is because you not prepare the recordsource for the adodb control
set the recordsource then you will not get the error?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1