• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 454
  • Last Modified:

Pass multiple values from MS Access form to Sql Server table with INSERT

I have a form with several combo boxes and I want to create a stored proc to insert the values from the form into a sql server table. I've done this with simple SP's using the InputParameters property on the form but I'm not sure how to do it with the INSERT statement.
  • 2
1 Solution
You know, if you didnt want a stored procedure, you can build up your SQL INSERT statement (eg INSERT INTO mytable (f1, f2, f3) VALUES (1,2,3) then use the Execute method of your ado connection object
stored procedure example. Not sure if this is what you have done already or the info you are looking for

    Set cmd = New ADODB.Command
    cmd.ActiveConnection = conn
    cmd.CommandText = "StoredProcName"
    cmd.CommandType = adCmdStoredProc
    cmd.ActiveConnection.CursorLocation = adUseServer     'to run on server

    cmd.Parameters.Append cmd.CreateParameter("ParameterName", Parameter type, parameter direction, length, Value)

    Set rs = cmd.Execute

If you double click on CreateParameter in order to highlight it then hit F1 it will take you to the help pages where it lists the enums of the parameter type and direction

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now