Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Unanswered: Importing Data from a form into a table

    I am doing a project in IT and it requires me to import data from a form into a table and i am struggling, any help on what the code should look like?

    The text boxes i have are called-TXTFirstname, TXTSurname, TXTAddy1, TXTAddy2, TXTAddy3, TXTPostcode and TXTContactnumber.

    Thanks

  2. #2
    Join Date
    Oct 2007
    Posts
    11
    DoCmd.RunSQL "insert into tablename (firstname, surname, addy1, postcode) values (" & sqltext(TXTFirstname.Value) & ", " & sqltext(TXTSurname.Value) & ", " & sqltext(TXTAddy1.Value) & ", " & sqltext(TXTpostcode.Value) & ");"

    The sqltext function should convert a string "abc'def" into "'abc' & chr(39) & 'def'", that is, adding a ' to the beginning and the end after substituting ' and other dangerous characters that may be in the string. If you are sure that the textboxes will never contain such characters, you can omit this function.

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    What kind of database are you using? SQL Server? Oracle? PostgreSQL? Access? Other?
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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