Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    49

    Unanswered: Submit Onclick = SQL Inster

    I am trying to insert data into a Access database via a SQL command.

    I have


    Code:
    Private Sub submit_Click()
    
    Set conDatabase = CurrentProject.Connection
    
    strSQL = "insert into ttblaudits (Department, Name) values ([cbemployees], [bxdepartments]);"
        
    conDatabase.Execute strSQL
        
    MsgBox "Complete"
    
    DoCmd.Close
    End Sub

    But it is not liking "conDatabase.Execute strSQL"

    Any tips?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    it wont like your INSERT much either!

    assuming department and name are both string, try

    "insert into ttblaudits (Department, Name) values ('" & [cbemployees] & "', '" & [bxdepartments] & "');"

    izy
    currently using SS 2008R2

Posting Permissions

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