Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15567

Run-time Error "3420" : Object Invalid OR No Longer Set

$
0
0
Hi.

i am using DAO method in VB6 for coding and access 2003 as a backhand.

when i am trying to restore data from tables to form "Run-time Error "3420" : Object Invalid OR No Longer Set" this error pop-ups. i didn't get this error till yesterday.

today i have added one Combo Box to the form. earlier i was calling one value from label.caption now i am calling that value from newly added combo box. but this is when i save the data. no new record is added today after this change.

below is the code where i am getting error...

Code:

Private Function CallVoucherVIEW()
'If cmdADD.Caption = "&EDIT" Then
    Dim VId As Integer
    VId = frmVoucherMSTR.ListView1.SelectedItem.Tag
    Set rs = db.OpenRecordset("Select * From VoucherPAY Where VouID = " & VId & " ")
        Text1.Text = rs!VouID
        Text2.Text = rs!CoCode
        Text3.Text = rs!ProjCode
        Text4.Text = rs!DeptID
        Combo4.Text = rs!FinYR
        Text5.Text = rs!VouNO
        DTPicker1.Value = rs!VouDt
        Text6.Text = rs!MVouNO
        DTPicker2.Value = rs!MVouDT
        Set rs1 = db.OpenRecordset("Select CoNAME from CompanyMSTR where CoCode = '" & Text2.Text & "' ")
            Combo1.Text = rs1!CoName
            rs1.Close
            Set rs1 = Nothing
        Set rs1 = db.OpenRecordset("Select ProjNAME from ProjectMSTR where ProjCode = '" & Text3.Text & "' ")
            Combo2.Text = rs1!ProjNAME
            rs1.Close
            Set rs1 = Nothing
        Set rs1 = db.OpenRecordset("Select DeptNM from DepartmentMSTR where DeptID = " & Text4.Text & " ")
            Combo3.Text = rs1!DeptNM
            rs1.Close
            Set rs1 = Nothing
        Text7.Text = rs!CashPaid
            ListView1.Enabled = False
            ListView1.Visible = False
        Text8.Text = rs!DebitParty & vbNullString
        Text9.Text = rs!Narration
        rs.Close
        Set rs = Nothing
       
    Set rs1 = db.OpenRecordset("Select * From VoucherPAY1 Where VouID = " & VId & " ")
        Text10.Text = rs1!LocalConvy
        Text11.Text = rs1!SunGenExp
        Text12.Text = rs1!Printing
        Text13.Text = rs1!Postage
        Text14.Text = rs1!Landline
        Text15.Text = rs1!Mobile
        Text16.Text = rs1!Food2EmpIBP
        Text17.Text = rs1!Food2EmpOBP
        Text18.Text = rs1!Food2NEmpIBP
        Text19.Text = rs1!EmpWelfare
        Text20.Text = rs1!StampRegis
        Text21.Text = rs1!CarriageInward
        Text22.Text = rs1!SundryLabour
        Text23.Text = rs1!FuelCar
        Text24.Text = rs1!Repair2CAR
        Text25.Text = rs1!ParkingExp
        Text26.Text = rs1!TollExp
        Text27.Text = rs1!FuelPickUP
        Text28.Text = rs1!RepairMainte
        Text29.Text = rs1!FuelGENERAL
        Text30.Text = rs1!DomesticTour
        Text31.Text = rs1!HotelExpEmp
        Text32.Text = rs1!HotelExpNEmp
        Text41.Text = rs1!ExpOTHER
        Text34.Text = rs1!ExpOTHERAmt
        Text35.Text = rs1!Exp1
        Text36.Text = rs1!Exp2
        Text37.Text = rs1!Exp3
        Text38.Text = rs1!Exp4
        Text39.Text = rs1!Exp5
        Text40.Text = rs1!VouTotal
        rs1.Close
    Set rs1 = Nothing
   
    cmdADD.Enabled = False
   
'    End If
End Function

if i Block Comment for highlighted in RED same error pop-ups for next 3 lines.
after using Block Comment for all 3 lines, it's working fine remaining part.

plz. point out where i am doing wrong.

thank you in advance.

- Kaushal

Viewing all articles
Browse latest Browse all 15567

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>