• Hi Srini

    Your exec command looks correct and I assume you have tested it to make sure it works. To execute it from within Access I think you have the right idea to put the job execution inside a stored procedure.

    Calling a stored procedure from Access ranges in difficulty from easy to a little challenging, dependent upon your VBA skills. I think in your case you have a simple job in that you don't appear to want to be able to pass stored procedure parameter values from the form. If I am wrong in this assumption just reply and I can guide you though using QueryDefs and values from controls on your form.

    But based in the assumption we have the simplest scenario, you firstly need to set up an Access pass-through query. Access Help gives details on how to do this and there will be plenty of info available via google if you have any difficulty. Basically, you create a new query, don't add tables, and open SQL view in the query editor. There will be an option for setting the query as a pass-through type - where this option is to be found, varies according to the version of Access you are using. You will have to add a connection to the database - having an ODBC connection already set up helps if you have to connect that way. Save the password in the connection (an option you will be prompted for) and set the returns records property to false.

    Getting the connection working is possibly the most challenging part and using an established ODBC connection will help to simplify it if you run into difficulties. Getting an ODBC connection working is one way of learning the connection requirements of your SQL Server db. NB. Make sure that the user profile under which the Access db is to be used has appropriate permissions on the database to which your stored procedure has been added.

    Save the query and test it by double-clicking. Having satisfied yourself that the job runs, you can move on to the next step which is to configure your button. You will need to create an "OnClick" event and use a simple DoCmd.OpenQuery command eg DoCmd.OpenQuery "qry_ExecSQLJob".

    The above is all fairly brief and over-simplified but gives you the outline of the steps required. Just post back if you need any help with any of the details.

    Cheers

    Rowan