Access VBA Parameter in passthrough query to SQL Server

后端 未结 4 1585
情歌与酒
情歌与酒 2020-12-11 10:51

I have several queries in an MS Access database. Some of these use parameters. I use the following code in VBA to provide the query with these parameters:

VB

4条回答
  •  温柔的废话
    2020-12-11 11:38

    The reply from Albert Kallal was spot on. Thanks Albert. I tried to comment after signing up but... did not have enough points to comment so... Hoping this goes through....

    The only thing I changed was....

    I replaced the Set rst = .OpenRecordset with...CurrentDb.QueryDefs("q_PTO_SubmitNewRequest").Execute

    Thanks again for posting this. It really was a HUGE help. I had many complex .adp projects years ago and am working with a client needing similar functionality. It looks like I can mirror the .adp functionality using the pass through queries. Very Cool :)

    With CurrentDb.QueryDefs("q_PTO_SubmitNewRequest")

      .SQL = strSQL
    

    End With

    CurrentDb.QueryDefs("q_PTO_SubmitNewRequest").Execute
    

提交回复
热议问题