runtime error 91

object variable or with block variable not set

Page 1 of 1

1 Replies - 2435 Views - Last Post: 08 October 2009 - 12:58 AM Rate Topic: -----

#1 exekiel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-October 09

runtime error 91

Post icon  Posted 02 October 2009 - 09:25 PM

may someone help me to solve my problem,,,please site what is wrong or missing with my program cause it always shows the object variable or with block variable not set in form2 of my program may someone site what is wrong or missing with my program.thanks for someone who will give time to solve my problem..

Private Sub cmd_backtank1_Click()
Unload Me
Form1.Show
End Sub


Public Sub cmd_enter_Click()

Adodc1.Recordset.Fields("tank_number") = lbl_tank1.Caption
Adodc1.Recordset.Fields("date") = lbl_date.Caption
Adodc1.Recordset.Fields("time") = lbl_time.Caption

Adodc1.Recordset.Fields("updates") = txt_valuetank1.Text
Adodc1.Recordset.Save

If txt_valuetank1.Text = "100" Or txt_valuetank1.Text >= 95 Then
Shape1.Visible = True
Else
If txt_valuetank1.Text >= "94" Or txt_valuetank1.Text >= 85 Then
Shape6.Visible = True
Else
If txt_valuetank1.Text >= "84" Or txt_valuetank1.Text >= 75 Then
Shape2.Visible = True
Else
If txt_valuetank1.Text >= "74" Or txt_valuetank1.Text >= 65 Then
Shape7.Visible = True
Else
If txt_valuetank1.Text >= "64" Or txt_valuetank1.Text >= 55 Then
Shape3.Visible = True
Else
If txt_valuetank1.Text >= "54" Or txt_valuetank1.Text >= 45 Then
Shape8.Visible = True
Else
If txt_valuetank1.Text >= "44" Or txt_valuetank1.Text >= 35 Then
Shape4.Visible = True
Else
If txt_valuetank1.Text >= "34" Or txt_valuetank1.Text >= 25 Then
Shape9.Visible = True
Else
If txt_valuetank1.Text >= "24" Or txt_valuetank1.Text >= 15 Then
Shape5.Visible = True
MsgBox "warning low oxygen supply", vbOKOnly
Else
If txt_valuetank1.Text >= "14" Or txt_valuetank1.Text >= 5 Then
Shape10.Visible = True
MsgBox "warning low oxygen supply", vbOKOnly
Else
If txt_valuetank1.Text >= "4" Or txt_valuetank1.Text >= 0 Then
Shape11.Visible = True
MsgBox "change tank", vbOKOnly
Else
MsgBox "cant be allocated", vbOKOnly
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If

End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\maricel\db3.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from monitor"
Adodc1.Recordset.AddNew
lbl_tank1.Caption = Form5.lbl_tank1.Caption
lbl_date.Caption = Date
lbl_time.Caption = Time
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: runtime error 91

#2 bytelogik  Icon User is offline

  • D.I.C Head

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

Re: runtime error 91

Posted 08 October 2009 - 12:58 AM

You have to put a "Refresh" method after you set the RecordSource !!
 
Private Sub Form_Load()

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\maricel\db3.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from monitor"

Adodc1.Refresh

Adodc1.Recordset.AddNew
lbl_tank1.Caption = Form5.lbl_tank1.Caption
lbl_date.Caption = Date
lbl_time.Caption = Time

End Sub

Mod Edit: When you are posting code please use code tags like this. :code:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1