在word 2010中选择acces datatbase

时间:2016-05-18 06:53:44

标签: vba access-vba word-2010

我必须从word 2010 in vba中的访问中选择一些行,现在我想选择一些东西但是我收到一个错误,说我的选择错了你能帮帮我吗?

Private Sub CommandButton1_Click()
Dim jahr As String
Dim LfdNummer As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSql As String
jahr = TextBox1
LfdNummer = TextBox2




Private Sub CommandButton1_Click()
Dim jahr As String
Dim LfdNummer As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSql As String
jahr = TextBox1
LfdNummer = TextBox2




Set db = CreateObject("DAO.DBEngine.120").OpenDatabase("C:\User/012886\Documents\Hendrik\trilux\EMV\Beispiel_EMV.accdb")

' Daten lesen und weiterverwenden -> über Recordset

Set rs = db.OpenRecordset("SELECT * FROM ITZ-EMV-Messungen")
Do While Not rs.EOF

  rs.MoveNext
Loop


 rs.Close
 db.Close

End Sub

1 个答案:

答案 0 :(得分:0)

尝试包围:[ITZ-EMV-Messungen]我认为它是破折号。