Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Melbourne
    Posts
    1

    Red face Unanswered: Transfering Data by VBA Code from one table to another

    Hello,

    I try to transfer data from one Access table to another. The code runs automatically when a special Form is opened.

    DoCmd.GoToRecord acTable, "test3_tjs", acFirst
    valuecarrier3 = F1.Value

    DoCmd.GoToRecord acTable, "test_tjs", acGoTo, valuecarrier2 + 1
    F1.Value = Str(valuecarrier3)

    DoCmd.GoToRecord acTable, "test3_tjs", acFirst
    valuecarrier3 = F2.Value

    DoCmd.GoToRecord acTable, "test_tjs", acGoTo, valuecarrier2 + 1
    F2.Value = valuecarrier3
    .....

    (the same for the following fields F3, F4, ...)

    so far so good, but when the code comes to field F7
    I get a message:
    Run-time error '424':
    Object required

    marking the line
    valuecarrier3 = F7.Value
    when I press on "Debug".

    Does anybody know why?

    Thanks!

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Hi Tim,

    Why don't you try SQL Insert:

    Example:

    strSQL = "Insert Into Table2 (F2a, F2b, F2c) Select F1a, F1b, F1c From Table 1 Where ID=" & Me.txtID & ";"
    docmd.execute strSQL

    Just make sure that (F2a, F2b, F2c) and (F1a, F1b, F1c) are the same data type and size.

    P.S. txtID - as a textbox on your form, which holds primary key value for Table1

    HTH

Posting Permissions

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