Does MS access(2003) have anything comparable to Stored procedure. I want to run a complex query in MS acceess

前端 未结 10 1534
无人及你
无人及你 2020-12-03 21:49

I have a table, call it TBL. It has two columns,call them A and B. Now in the query I require one column as A and other column should be a comma seprated list of all B\'s wh

相关标签:
10条回答
  • 2020-12-03 22:21

    Perhaps instead of asking if Jet has stored procedures, you should explain what you want to accomplish and then we can explain how to do it with Jet (it's not clear if you're using Access for your application, or just using a Jet MDB as your data store).

    0 讨论(0)
  • 2020-12-03 22:22

    There is not a way that I know of to run stored procedures in an Access database. However, Access can execute stored procedures if it is being used against a SQL backend. If you can not split the UI to Access and data to SQL, then your best bet will probably be to code a VBA module to give you the output you need.

    0 讨论(0)
  • 2020-12-03 22:26

    I believe you can create VBA functions and use them in your access queries. That might help you.

    0 讨论(0)
  • 2020-12-03 22:26

    You can write your stored procedure as text and send it against the database with:

    Dim sp as string
    sp = "your stored procedure here" (you can load it from a text file or a memo field?)
    
    Access.CurrentProject.AccessConnection.Execute sp
    

    This supposes you are using ADODB objects (ActiveX data Objects Library is coorectly referenced in your app).

    I am sure there is something similar with DAO ...

    0 讨论(0)
  • 2020-12-03 22:29

    You can use GetString in VBA which will return the recordset separated by any value you like (e.g. comma, dash, table cells etc.) although I have to admit I've only used it in VBScript, not Visual Basic. W3Schools has a good tutorial which will hopefully lend itself to your needs.

    0 讨论(0)
  • 2020-12-03 22:30

    No stored procedures, no temporary tables.

    If you needed to return the query as a recordset, you could use a disconnected recordset.

    0 讨论(0)
提交回复
热议问题