请教:我下面一段例程用通用的工作组文件没问题,用自己的工作组文件运行就出现:
★不是有效的账户名或密码 ★的提示。
我知道要写入些什么账户、密码之类的东西,却不知如何着手,有高手能帮助我一下吗?先谢了。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Command0_Click()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim dhj, hx, gh As String
dhj = "251934打火机"
'Dim strConnectString As String
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.ConnectionString = CurrentProject.Connection
cnn.Open '★在这里出错,提示:不是有效地账户名或密码 ★
rst.ActiveConnection = cnn
'rst.Open "Select * from 进货品种 Where 进货品种 ='251934打火机'"
rst.Open "Select * from 进货品种 Where 进货品种 ='" & dhj & "'"
Do Until rst.EOF
'Debug.Print rst!Stor_id, rst!Qty
hx = rst!盒箱
gh = rst!个盒
MsgBox hx
MsgBox gh
rst.MoveNext
Loop
rst.Close
cnn.Close
Set cnn = Nothing
Set rst = Nothing
End Sub
如果在ACCESS使用ADO
只需要:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.open "Select * from 进货品种 Where 进货品种 ='" & dhj & "'",CurrentProject.Connection,1,1(1,1只读 1,3读写)
你的问题书上翻的,是否正确自己测试
Set cnn = New ADODB.Connection
cnn.ConnectionString ="rovider=Microsoft.jet.oledb.4.0assword=";"Data Source=c:\***.mdb(路径)"
cnn.open
Set rst.ActiveConnection = cnn
******