#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Aug 2006
    Posts
    99
    Rep Power
    13

    Exclamation Append Current Record to another Table


    Im trying to make a button that sends the current open record information to another table. I created an append Query but it is pulling nothing. Can someone help me figure out how to send the current open file to a seperate table?
  2. #2
  3. Database junkie..
    ASP Scholar (3000 - 3499 posts)

    Join Date
    May 2004
    Location
    Derry, N Ireland
    Posts
    3,092
    Rep Power
    58
    'grab the values of the textboxes on the form
    dim myvalue1, myvalue2, mysql
    'value1 is numeric
    myvalue1 = me.[my numeric data textbox name]
    'value2 is text
    myvalue2 = me.[my text data textbox name]
    'create the SQL to insert into another table
    mysql = "INSERT INTO MyOtherTable (NumericField, TextField) VALUES (" & myvalue1 & ", '" & myvalue2 & "');"
    'execute sql
    DoCmd.RunSQL mysql

    'Note the use of ' for text fields in the SQL statement
    Regards,

    Colm



    If you found a post particularly helpful, show your appreciation by clicking the "scales" icon in the bar just above the post, at the right hand side.
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Aug 2006
    Posts
    99
    Rep Power
    13
    Originally Posted by meloncolly
    'grab the values of the textboxes on the form
    dim myvalue1, myvalue2, mysql
    'value1 is numeric
    myvalue1 = me.[my numeric data textbox name]
    'value2 is text
    myvalue2 = me.[my text data textbox name]
    'create the SQL to insert into another table
    mysql = "INSERT INTO MyOtherTable (NumericField, TextField) VALUES (" & myvalue1 & ", '" & myvalue2 & "');"
    'execute sql
    DoCmd.RunSQL mysql

    'Note the use of ' for text fields in the SQL statement

    Does this copy the whole master form or two boxes? Sorry to ask so many questions, I am heading to where im gonna be working on this soon and want to jump on it as soon as poosible! THANKS SO MUCH!
  6. #4
  7. Database junkie..
    ASP Scholar (3000 - 3499 posts)

    Join Date
    May 2004
    Location
    Derry, N Ireland
    Posts
    3,092
    Rep Power
    58
    my example shows you how to handle text and numeric data (because they have to be handled differently)

    you have to expand this yourself to cover all your fields.
  8. #5
  9. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Aug 2006
    Posts
    99
    Rep Power
    13
    Originally Posted by meloncolly
    my example shows you how to handle text and numeric data (because they have to be handled differently)

    you have to expand this yourself to cover all your fields.
    Gotcha thanks I understand clearly! You Guys are the best!

Similar Threads

  1. Append Query to table
    By bigbadbess24 in forum Microsoft Access Help
    Replies: 3
    Last Post: March 22nd, 2006, 02:50 PM
  2. any way changing add duplicate code to append to a table?
    By MOTTY in forum Microsoft Access Help
    Replies: 0
    Last Post: December 13th, 2004, 07:08 AM
  3. Delete Current Record Button
    By deurwaarder in forum Microsoft Access Help
    Replies: 2
    Last Post: December 11th, 2004, 02:40 PM
  4. Auto Numbering
    By woodstockjs in forum Microsoft Access Help
    Replies: 2
    Last Post: September 28th, 2004, 11:19 AM
  5. Lose record edit via form; input continues as new record
    By Karenk in forum Microsoft Access Help
    Replies: 1
    Last Post: September 23rd, 2004, 02:19 PM

IMN logo majestic logo threadwatch logo seochat tools logo