splitted database crashes when adding records to linked table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • k

    #1

    splitted database crashes when adding records to linked table

    Hi all

    I split a database in a table-part and a all-the-rest-part and linked
    the tables, but my code adding records to a table crashes on

    Set rs = db.OpenRecordse t("tblDeltakels e", dbOpenTable,
    dbAppendOnly)

    I think, some places where I do the same thing to another table it just
    says "Invalid Operation", I press OK and nothing happens, and I am just
    as wise as to what operation was invalid.

    I guess the OpenRecordset needs to know that it's supposed to open a
    table that is linked, but I have no idea how to tell it that.

    Anyone?
    K

  • Lyle Fairfield

    #2
    Re: splitted database crashes when adding records to linked table

    k wrote:[color=blue]
    > Set rs = db.OpenRecordse t("tblDeltakels e", dbOpenTable,
    > dbAppendOnly)[/color]

    Use dbOpenDynaset with linked tables.

    --
    --
    Lyle
    --

    Comment

    • k

      #3
      Re: splitted database crashes when adding records to linked table

      Thanks

      But "method or data member not found"

      I guess I should replace my line right before the openrecordset:
      Set db = CurrentDb

      with something else, to indicate that I am opening another db?

      I'm a bit clueless here, nubi with this coding stuff in access

      K

      Comment

      • Trevor Best

        #4
        Re: splitted database crashes when adding records to linked table

        k wrote:[color=blue]
        > Thanks
        >
        > But "method or data member not found"
        >
        > I guess I should replace my line right before the openrecordset:
        > Set db = CurrentDb
        >
        > with something else, to indicate that I am opening another db?
        >
        > I'm a bit clueless here, nubi with this coding stuff in access
        >
        > K
        >[/color]

        Are you sure you have a reference to DAO? What choices do you get from
        the intellisense dropdown?

        --
        This sig left intentionally blank

        Comment

        • k

          #5
          Re: splitted database crashes when adding records to linked table

          I guess I'm in over my head here, my db was working fine, but I wanted
          to split it to easier make updates.
          I seem not to be able to answer your questions...

          Q: Are you sure you have a reference to DAO
          A: I'm not sure, I don't know what you mean, and really never got the
          hang of DAO...

          Q: What choices do you get from the intellisense dropdown?
          A: What is the intellisense dropdown?

          Comment

          • Trevor Best

            #6
            Re: splitted database crashes when adding records to linked table

            k wrote:[color=blue]
            > I guess I'm in over my head here, my db was working fine, but I wanted
            > to split it to easier make updates.
            > I seem not to be able to answer your questions...
            >
            > Q: Are you sure you have a reference to DAO
            > A: I'm not sure, I don't know what you mean, and really never got the
            > hang of DAO...[/color]

            If it was working before it must have been there, the method of data
            access you're using is DAO.
            [color=blue]
            > Q: What choices do you get from the intellisense dropdown?
            > A: What is the intellisense dropdown?
            >[/color]

            When you type something like "db." in the code window you get a dropdown
            list of methods and properties for the database object.

            --
            This sig left intentionally blank

            Comment

            • k

              #7
              Re: splitted database crashes when adding records to linked table

              > When you type something like "db." in the code window you get a
              dropdown[color=blue]
              > list of methods and properties for the database object.
              >
              > --
              > This sig left intentionally blank[/color]

              Thanks for hanging in there with me...

              The dropdown doesn't give me a .opendynaset but the openrecordset is
              there.

              I paste the whole code-piece here, what i does, or what it did before i
              split my db, was to add a number of records to a many-to-many relation
              table (tbl1), based on the selected items in a list.



              Dim db As DAO.Database
              Dim rs As DAO.Recordset
              Dim varEvent As Variant
              Dim ctlEvent As Control

              Set ctlEvent = Me.List1
              Set db = CurrentDb
              Set rs = db.OpenRecordse t("tbl1", dbOpenTable, dbAppendOnly)

              For Each varEvent In ctlEvent.ItemsS elected
              rs.AddNew
              rs.Fields("fiel d1") = Me.ID
              rs.Fields("fiel d2") = ctlEvent.ItemDa ta(varEvent)
              rs.Update
              Next varEvent
              rs.Close
              Set rs = Nothing
              Set db = Nothing


              I guess the first to codelines is my reference to DAO...
              K

              Comment

              • Trevor Best

                #8
                Re: splitted database crashes when adding records to linked table

                k wrote:[color=blue][color=green]
                >>When you type something like "db." in the code window you get a[/color]
                >
                > dropdown
                >[color=green]
                >>list of methods and properties for the database object.
                >>
                >>--
                >>This sig left intentionally blank[/color]
                >
                >
                > Thanks for hanging in there with me...
                >
                > The dropdown doesn't give me a .opendynaset but the openrecordset is
                > there.[/color]

                Set rs = db.OpenRecordse t("tbl1", dbOpenDynaset, dbAppendOnly)


                --
                This sig left intentionally blank

                Comment

                • k

                  #9
                  Re: splitted database crashes when adding records to linked table


                  Trevor Best wrote:[color=blue]
                  >
                  > Set rs = db.OpenRecordse t("tbl1", dbOpenDynaset, dbAppendOnly)
                  >
                  >
                  > --
                  > This sig left intentionally blank[/color]

                  Thank you Trevor!

                  K

                  Comment

                  Working...