object variable or with block variable not set

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sachin udmale
    New Member
    • Aug 2011
    • 1

    object variable or with block variable not set

    Sub isave()
    Me.Adodc1.Recor dset.AddNew
    Me.Adodc1.Recor dset.Fields(0) = txtid.Text
    Me.Adodc1.Recor dset.Fields(1) = txtregistryno.T ext
    Me.Adodc1.Recor dset.Fields(2) = txtcitymun.Text
    Me.Adodc1.Recor dset.Fields(3) = txtname.Text
    Me.Adodc1.Recor dset.Fields(4) = txtage.Text
    Me.Adodc1.Recor dset.Fields(5) = txtsex.Text
    Me.Adodc1.Recor dset.Fields(6) = txtreligion.Tex t
    Me.Adodc1.Recor dset.Fields(7) = txtdatedeath.Te xt
    Me.Adodc1.Recor dset.Fields(8) = txtpdeath.Text
    Me.Adodc1.Recor dset.Fields(9) = txtresidence.Te xt
    Me.Adodc1.Recor dset.Fields(10) = txtcivilstatus. Text
    Me.Adodc1.Recor dset.Fields(11) = txtoccupation.T ext
    Me.Adodc1.Recor dset.Fields(12) = txtcause.Text
    Me.Adodc1.Recor dset.Fields(13) = txtbdissue.Text
    Me.Adodc1.Recor dset.Update
    MsgBox "Recod Added Successfully... ", vbExclamation
    clear
    End Sub

    Private Sub cmds_Click()
    isave
    End Sub


    it occurs runtime error 91"object variable or with block variable not set"
    ...i done as much as i could...can any1 help me out
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    You do not show where you have initialised the control you have named as adodc1's recordset - you have to have initialised it somewhere via an open connection before you can use it. You are not doing so in your isave sub. Have you done so somewhere else?

    What is adodc1 anyway? You do not say.

    It would be useful to see the whole context of what you are doing, and to have some information from you about where exactly the error is occurring and what you have done so far to debug the code.

    -Stewart

    Comment

    Working...