Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    11

    Unhappy Unanswered: Error '424 Object Required' keeps occurring. PLEASE HELP

    Hi everyone,
    just wondering if someone could help me out with the problem in my code. im new to access/vbscript and dont really understand some of the stuff. ok here is the current code im trying to run at this moment. The error '424' object requires keeps popping up for the line in red. can anyone suggest anything?

    Private Sub Custodian_History_Form_Enter()

    Me.[Custodian History form].Nodes.Add Text:="Custodian History", Key:="Custodian History"
    Me.[Custodian History form].Nodes.Add relationship:=tvwChild, Relative:="Custodian History", Text:="AssetNumber"
    Me.[Custodian History form].Nodes.Add relationship:=tvwChild, Relative:="Custodian History", Text:="Custodian ID"
    Me.[Custodian History form].Nodes.Add relationship:=tvwChild, Relative:="Custodian History", Text:="On Date"
    Me.[Custodian History form].Nodes.Add relationship:=tvwChild, Relative:="Custodian History", Text:="Off Date"
    Me.[Custodian History form].Nodes.Add relationship:=tvwChild, Relative:="Custodian History", Text:="Changes in Asset"

    Dim Data_Base1 As DAO.Database
    Dim Record_Set1 As DAO.Recordset
    Dim Query_Def1 As QueryDef
    Dim strcombo As String
    Set Data_Base1 = CurrentDb()
    Set Query_Def1 = Data_Base1.CreateQueryDef("")
    Query_Def1.SQL = "SELECT [AssetNumber] FROM [Asset Master];"
    Set Record_Set1 = Query_Def1.OpenRecordset()

    With Record_Set1

    Do While Not .EOF

    strcombo = Record_Set1("AssetNumber")
    AssetNumber.AddItem strcombo
    Me.[Custodian History form].Nodes2.Add relationship:=tvwsibling, Relative:="Changes in asset", Text:="strcombo"
    .MoveNext
    Loop
    .Close

    End With

    Set rs1 = Nothing

    db.Close

    End Sub

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Maybe I'm reading this wrong but what overall exactly are you trying to do? I just got this feeling that what you're trying to accomplish (overall) could be done in an easier way.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    May 2009
    Posts
    11
    Im trying to create a treeview which starts off with custodian history as the first branch. Assetnumber, custodian ID, On date, off date and changes in assets as the next level. I then want to read a table of values (asset master table, assetnumber column) and insert it under the assetnumber branch of the tree. Does that make sense?
    thanks for your help

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I "think" I understand but not sure I can help you. I think someone who's worked more with treeviews is better. There is this example from Aran1 on treeviews in the code bank if that's any help: http://www.dbforums.com/6326489-post65.html. I personally plan on researching it more when I get some free time.

    Otherwise I hope you get some other responses.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    May 2009
    Posts
    11
    Thanks alot for your help pkstormy
    ive been working on this for nearly a month. Its the hardest coding ive ever done considering i extremely new to it and there isn't much help on the net.
    once again thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •