• Create a new record in another table (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Create a new record in another table (2000)

    Author
    Topic
    #397634

    Anyone any ideas for the following:
    I have a form which is used to allow the selection of a number of records. As each record is selected a number of calculated values are recorded to show total amount of stock delivered and total value of stock. I’ve got that all working – no problem…..
    next……
    I’m now attempting to write the total fields, along with some other information, to a table in another database. This should be recorded as a new record in a table.
    My first attempt is as follows:

    DoCmd.OpenTable “PODel”, acViewNormal
    DoCmd.GoToRecord , , acNewRec
    LotNum = Forms!LotPricing!LotNumber
    PONum = Forms!LotPricing!PurchNo
    DelQty = Forms!LotPricing!SumInvWeight
    DelNum = Forms!LotPricing!DelNo
    DelReviser = “Auto”
    DelDate = Forms!LotPricing!DateBookedIn
    LineID = Forms!LotPricing!RawID
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.Close acTable, “PODel”, acSaveYes

    But it doesn’t append the record.

    Any one give me a pointer to how I should approach this?

    I guess I’m trying to produce, in effect, a transaction summary file

    Any help appreciated

    Viewing 1 reply thread
    Author
    Replies
    • #754498

      You’re mixing instructions for forms and tables together; unfortunately that won’t work.

      Is PODel a linked table, connected to a table in another database? If so, you could either create an append query and execute that, or use DAO or ADO code to append a record. Are you familiar with either of these?

      • #754508

        I’m not familiar with DAO or ADO.
        The option of using an append query sounds a possibility – I’ll investigate that one further.
        Yes, the PODel table is linked to a table in another database.

        As I right in thinking that once I’m working with one dataset (I know as much about datasets as I do about DAO and ADO) the only way to add to another table is via this route of an append query or the DAO ADO option
        John

        • #754538

          Using an append table worked great – thanks

        • #754539

          Using an append table worked great – thanks

      • #754509

        I’m not familiar with DAO or ADO.
        The option of using an append query sounds a possibility – I’ll investigate that one further.
        Yes, the PODel table is linked to a table in another database.

        As I right in thinking that once I’m working with one dataset (I know as much about datasets as I do about DAO and ADO) the only way to add to another table is via this route of an append query or the DAO ADO option
        John

    • #754499

      You’re mixing instructions for forms and tables together; unfortunately that won’t work.

      Is PODel a linked table, connected to a table in another database? If so, you could either create an append query and execute that, or use DAO or ADO code to append a record. Are you familiar with either of these?

    Viewing 1 reply thread
    Reply To: Create a new record in another table (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: