Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Insert info into tbl from a form (2003)

    Hi, I am breaking my head. I am working with this INSERT INTO statement under a on click procedure. I want to be able to populate a tbl with information inserted in a text box on a open form.

    This is the code I am using. I am trying to capute the taskID of the fom and the remarks inserted on the unbound texbox. and send it to the fields available in the tblUserRemarks. Any help

    Private Sub cmdInsertRemark_Click()
    Dim strSQL As String

    strSQL = "INSERT INTO tblUserRemarks (TaskID, Remarks) SELECT (Me.TaskID & " & _
    Chr$(34) & Me.txtRemark & Chr$(34) & ")" FROM frmTask

    CurrentDb.Execute strSQL

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Insert info into tbl from a form (2003)

    A form cannot be used as if it were a table in SQL. Try this:

    strSQL = "INSERT INTO tblUserRemarks (TaskID, Remarks) VALUES (" & Me.TaskID & ", " & _
    Chr$(34) & Me.txtRemark & Chr$(34) & ")"

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Insert info into tbl from a form (2003)

    Hans, you always have the answer for everything. That surely did the trick.

Posting Permissions

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