SQL Insert Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shokoth
    New Member
    • Apr 2007
    • 29

    SQL Insert Help

    Hi,
    i am trying to insert into a table, at run time useing a form. i am using the following line:

    strSQL = "INSERT INTO [tblRequestRespo nse]([Request ID], [Service Offered], [Service Provider], [ServiceName], [Description], [CostPerHour]) " & _

    "VALUES (froms![frmServiceProvi derInfo].[lstRequest.colu mn(0)], Forms![sbfrmServices].[ServiceID], Forms![frmServiceProvi derInfo].[tblMembers_User Name], Forms![sbfrmServices].[ServiceName], Forms![sbfrmServices].[Description], Forms![sbfrmServices].[CostPerHour]);"

    DoCmd.RunSQL strSQL

    This is not working, and i get an eror message saying undefined function froms![frmServiceProvi derInfo].[lstRequest.colu mn(0)].

    Does anyone know what the problem is.

    ps. i am there is a list there, and weneva a product is doubleclicked, this should happen (insert into a table)
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Originally posted by Shokoth
    Hi,
    i am trying to insert into a table, at run time useing a form. i am using the following line:

    strSQL = "INSERT INTO [tblRequestRespo nse]([Request ID], [Service Offered], [Service Provider], [ServiceName], [Description], [CostPerHour]) " & _

    "VALUES (froms![frmServiceProvi derInfo].[lstRequest.colu mn(0)], Forms![sbfrmServices].[ServiceID], Forms![frmServiceProvi derInfo].[tblMembers_User Name], Forms![sbfrmServices].[ServiceName], Forms![sbfrmServices].[Description], Forms![sbfrmServices].[CostPerHour]);"

    DoCmd.RunSQL strSQL

    This is not working, and i get an eror message saying undefined function froms![frmServiceProvi derInfo].[lstRequest.colu mn(0)].

    Does anyone know what the problem is.

    ps. i am there is a list there, and weneva a product is doubleclicked, this should happen (insert into a table)
    You have used the word Froms instead of Forms

    Comment

    • Shokoth
      New Member
      • Apr 2007
      • 29

      #3
      i still get the same error.

      within the main form,there is a list, a tabbed frams, and the actual form.
      i am trying to insert data from a subform inside the tab control, a list box and the actual form itself.

      is that possible

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by Shokoth
        i still get the same error.

        within the main form,there is a list, a tabbed frams, and the actual form.
        i am trying to insert data from a subform inside the tab control, a list box and the actual form itself.

        is that possible
        Try this ...

        Code:
        Forms![frmServiceProviderInfo]!lstRequest.Column(0)

        Comment

        • pks00
          Recognized Expert Contributor
          • Oct 2006
          • 280

          #5
          U could try this, get the value outside the string


          strSQL = "INSERT INTO [tblRequestRespo nse]([Request ID], [Service Offered], [Service Provider], [ServiceName], [Description], [CostPerHour]) " & _
          "VALUES "( & forms!frmServic eProviderInfo!l stRequest.Colum n(0) & ", Forms![sbfrmServices].[ServiceID], Forms![frmServiceProvi derInfo].[tblMembers_User Name], Forms![sbfrmServices].[ServiceName], Forms![sbfrmServices].[Description], Forms![sbfrmServices].[CostPerHour]);"

          Comment

          • Shokoth
            New Member
            • Apr 2007
            • 29

            #6
            I tried both of these,but it stilll didint work, but i worked a way rpound it.

            Created a textbox, made it invisible, and once double cliked, the value of the list.coloumn is written to that text box, and that value is then inserted.

            Thanks for the help

            Comment

            Working...