从其他DB中选择数据 [英] Select data from other DB

查看:53
本文介绍了从其他DB中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello NG

我想从另一个数据库中选择数据,并在currentDB中使用这些数据。

我在VBA程序中有这个SQL:

Sql =" SELECT * FROM Firma [MS Access; Database =" &安培; strPath& strFileName&

" ;;]"


不工作


任何建议......


提前致谢...


Bjarne

解决方案

< BLOCKQUOTE>" BSN" < bsnsnabelaoncabledotdk>在消息中写道

news:43 *********************** @ dread12.news.tele.d k ... < Helloquote class =post_quotes> Hello NG
我想从另一个数据库中选择数据,并在currentDB中使用这个数据。
我在VBA程序中有这个SQL:
Sql =" SELECT * FROM Firma [MS Access; Database =" &安培; strPath& strFileName&
" ;;]"

它不工作

任何建议......

提前致谢。 ..

Bjarne



语法不太正确,你错过了IN"

这种格式是如果您需要设置其他属性(如

密码),则需要输入以下内容:

SELECT * FROM MyTable IN"" [MS Access; PWD = secret; DATABASE = C:\ Test.mdb]


但是,如果没有,您还可以使用更简单的表格:

SELECT * FROM MyTable IN" C:\ Test.mdb"




" Anthony England" < AE ****** @ oops.co.uk> skrev

语法不太正确,你缺少IN"
如果你需要设置其他属性,例如
密码,这种格式很有用。然后你需要得到类似的东西:
SELECT * FROM MyTable IN"" [MS Access; PWD = secret; DATABASE = C:\ Test.mdb]

但是,如果没有,您也可以使用更简单的形式:
SELECT * FROM MyTable IN" C:\ Test.mdb"



谢谢...我试过这个SQL,但是它没有用......


SELECT * FROM Firma IN" C:\Documents and Settings\Bjarne S.

Nielsen \Skrivebord\Wl2kdata.mdb"


Bjarne




" Anthony England" < ae ****** @ oops.co.uk>

语法不太正确,你错过了IN"
这种格式对你有用需要设置其他属性,例如密码,然后你需要最终得到类似的东西:
SELECT * FROM MyTable IN"" [MS Access; PWD = secret; DATABASE = C:\ Test.mdb]



如果我尝试在QBE中运行sql,那么它进展顺利,但不在我的VBA中代码:


Sql =" SELECT * FROM Firma IN""" [MS Access; DATABASE =" &安培; strPath&

strFileName& " ;;]"

RS.Open Sql

Debug.Print Rs!FirmaID


Bjarne


Hello NG
I want to select data from another DB, and use this data in currentDB.
I have this SQL in a VBA procedure:
Sql = "SELECT * FROM Firma [MS Access;Database=" & strPath & strFileName &
";]"

It is not working

Any suggestions...

Thanks in advance...

Bjarne

解决方案

"bsn" <bsnsnabelaoncabledotdk> wrote in message
news:43***********************@dread12.news.tele.d k...

Hello NG
I want to select data from another DB, and use this data in currentDB.
I have this SQL in a VBA procedure:
Sql = "SELECT * FROM Firma [MS Access;Database=" & strPath & strFileName &
";]"

It is not working

Any suggestions...

Thanks in advance...

Bjarne


The syntax is not quite right, you are missing the IN ""
This format is useful if you needed to set other attributes, such as a
password, then you need to end up with something like:
SELECT * FROM MyTable IN "" [MS Access;PWD=secret;DATABASE=C:\Test.mdb]

However, if not, you could also use a simpler form:
SELECT * FROM MyTable IN "C:\Test.mdb"



"Anthony England" <ae******@oops.co.uk> skrev

The syntax is not quite right, you are missing the IN ""
This format is useful if you needed to set other attributes, such as a
password, then you need to end up with something like:
SELECT * FROM MyTable IN "" [MS Access;PWD=secret;DATABASE=C:\Test.mdb]

However, if not, you could also use a simpler form:
SELECT * FROM MyTable IN "C:\Test.mdb"


Thank you...I tried this SQL, but it is not working...

SELECT * FROM Firma IN "C:\Documents and Settings\Bjarne S.
Nielsen\Skrivebord\Wl2kdata.mdb"

Bjarne



"Anthony England" <ae******@oops.co.uk>

The syntax is not quite right, you are missing the IN ""
This format is useful if you needed to set other attributes, such as a
password, then you need to end up with something like:
SELECT * FROM MyTable IN "" [MS Access;PWD=secret;DATABASE=C:\Test.mdb]


If I try to run the sql in QBE, then it goes well, but not in my VBA code:

Sql = "SELECT * FROM Firma IN """" [MS Access;DATABASE=" & strPath &
strFileName & ";]"
RS.Open Sql
Debug.Print Rs!FirmaID

Bjarne


这篇关于从其他DB中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆