Office中国论坛/Access中国论坛

标题: SQL语句脾气不小 [打印本页]

作者: mingxuan1313    时间: 2012-6-13 11:34
标题: SQL语句脾气不小

在SQL语句中嵌套使用自定义字符串变量,必须先定义一个新的整体的字符串变量

Public Function nott(textt As String)
Dim rs As New ADODB.Recordset
Dim tt As String
Dim sqll As String
sqll = "select * From logg where [姓名] = '" & Forms!登录!Text0 & "'"
'tt = Forms!登录!Text0
'MsgBox (Trim(tt))
'MsgBox (mr(Forms!登录!Text0))
'rs.Open "select * From logg where [姓名] = mr() ", CurrentProject.Connection, , adLockOptimistic
MsgBox (sqll)
rs.Open sqll, CurrentProject.Connection, , adLockOptimistic

MsgBox (rs![姓名])

MsgBox (rs![ID])
rs![内容] = "2" & tt
rs.Update
rs.Close
Set rs = Nothing
End Function




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3