Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004

    Unanswered: Insert new record into table by form

    i have a problem how to insert the new record into the old table using the form that i named " ADD NEW RECORD"


    Table PC

    PC_series PC_name
    111 Hewlet Packard
    222 IBM

    So, i create a form named " ADD NEW RECORD ".in this form, user will fill the form with the new PC Name.what i want is,the new entry record automatically enter to the old table(Table PC).how??

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland

    your form has textboxes: newSeries, newName
    your table is called PC

    dim strSQL as string
    strSQL = "INSERT INTO PC (PC_Series, PC_Name) VALUES ('"
    strSQL = strSQL & newSeries & "', '" & newName & "');"
    docmd.setwarnings false
    docmd.runsql strSQL
    docmd.setwarnings true

    i treated PC_Series as text - you should drop the first two ' if it is numeric

    ...and then find a suitable event to host the code: perhaps buttonOK_Click() or _Unload() or whatever suits you

    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2004
    how can i do if i don't use VB code?

Posting Permissions

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