问题描述
这是我第一次发现这个问题,很有意思。我有如下查询:
This is my first time to find this problem, it is interesting. I have a query like below:
SELECT * FROM TABLE1
SELECT * FROM TABLE1
WHERE TABLE1.ID> @ Param1 AND
WHERE TABLE1.ID > @Param1 AND
          TABLE1.ID IN(SELECT ID FROM ...
TABLE1.ID IN (SELECT ID FROM ...
WHERE Name = @ Param2)
WHERE Name = @Param2)
当我使用Sql Server或Oracle时,我总是首先附加Param1然后附加Param2。但是当我使用Access时,我发现它无法运行
When I use Sql Server or Oracle I always append Param1 first then append Param2. But I find that it can not work
。我必须首先附加Param2然后附加Param1,然后才能工作。我在
中执行了这个sql文本
when I use Access. I must append Param2 first then append Param1, then it can work. I executed this sql text in
Access,实际上Access要求我先输入Param2的值。
Access, actually Access asked me input a value for Param2 first.
所以我的问题是:如果我仍然想先添加Param1然后在我使用Access时附加Param2然后我应该做什么?
So my question is: If I still want to append Param1 first then append Param2 when I use Access then what I should do?
非常感谢。
CanadaProgrammer
CanadaProgrammer
推荐答案
dim qd as dao。 querydef
dim rs as dao.recordset
set qd = currentdb.querydefs(" myQuery")
qd!param1 = Inputbox(" ; param1的值?")
qd.param2 =输入框(" param2的值?")
set rs = qd.OpenRecordset(dbOpenSnapshot)
dim qd as dao.querydef
dim rs as dao.recordset
set qd = currentdb.querydefs("myQuery")
qd!param1 = Inputbox("Value of param1?")
qd.param2 = Inputbox("Value of param2?")
set rs = qd.OpenRecordset(dbOpenSnapshot)
'等。
这篇关于子查询中参数的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!