|
库不用链接表,都用
x(0) = "select * from lingjianbiao where bianhao='" & Me.Text7 & "'"
rs(0).Open x(0), Z_CnnDB_S, 1, 3, 512
这样的方式下载数据到本地表
'打开服务数据库Data的connection连接
Option Compare Database
Public Z_CnnDB_S As ADODB.Connection
Function AutoExec()
On Error GoTo err_1
Set Z_CnnDB_S = New ADODB.Connection
Z_CnnDB_S.CursorLocation = adUseClient
Z_CnnDB_S.Provider = "Microsoft.Jet.OLEDB.4.0"
Z_CnnDB_S.Open "Data Source=" & "\\srv-lj-01\Application\Express & P.O" & "\Document_Data.mdb;Jet OLEDbataBase Password=123456"
err_2:
Exit Function
err_1:
MsgBox err.Number & err.Description
Resume err_2
End Function
问题:子窗有多条记录,在主窗做了个保存按钮,下面是按钮代码,想实现点保存把子窗多条记录更新到表后台表lingjianbiao ,怎么写才对?
x(0) = "select * from lingjianbiao where bianhao='" & Me.Text7 & "'"
rs(0).Open x(0), Z_CnnDB_S, 1, 3, 512
Me.lit_lingjianbiao_lchd.Form.Recordset.MoveFirst
Do Until Me.lit_lingjianbiao_lchd.Form.Recordset.EOF
rs(0)!bianhao = Me.lit_lingjianbiao_lchd.Form.bianhao
rs(0)!mingcheng = Me.lit_lingjianbiao_lchd.Form.mingcheng
rs(0).update
Me.lit_lingjianbiao_lchd.Form.Recordset.MoveNext
Loop
rs(0).Close
如果用 update xxx set aaa=bbb 会找不到表的,因为库没有连接表 |
|