现需将表1中字段(数字类型)1、字段2......字段11内容按条件更新到 录入窗体的 录入1、录入2......录入11:
Dim i As Integer
for i =1 to 11
if me("录入" & i)>0 then
DoCmd.RunSQL "update 表1 set '字段' & i = '" & Me("录入" & i) & "' “
else
end if
next i ,以上语句语法错误,求各位指点。万分感谢!!!
Dim i As Integer ,mySQL as string
for i =1 to 11
if me("录入" & i)>0 then
mySQL="UPDATE 表1 SET 字段"& i &"="& Me.Controls("录入"& i)
CurrentProject.Connection.Execute (MySQL)
else
end if
next i
mySQL="UPDATE 表1 SET 字段"& i &"="& Me.Controls("录入"& i) & " WHERE where ID=" & me.ID ‘id字段为数字的情况
mySQL="UPDATE 表1 SET 字段"& i &"="& Me.Controls("录入"& i) & " WHERE where ID='" & me.ID & "'" ‘id字段为文本的情况
mySQL="UPDATE 表1 SET 字段"& i &"="& Me.Controls("录入"& i) & " WHERE where ID=#" & me.ID & "#" ‘id字段为日期的情况