根据表1的原号,将jpg图片改为表1中的新号,用了Name As 语句,但提示标准表达式数据类型不匹配!不知道语句错在哪里?请大家指点!作者: todaynew 时间: 2014-12-16 11:44
id为数字型,不能加单引号。作者: ylj26518 时间: 2014-12-16 12:25
Private Sub 查找相片_Click()
Dim j As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim fileName
rs.Open "表1", CurrentProject.Connection, adOpenKeyset, adLockPessimistic
js = rs.RecordCount
rs.MoveFirst
For j = 1 To rs.RecordCount
fileName = (rs.Fields(1).Value)
Name CurrentProject.Path & "\" & fileName & ".jpg" As CurrentProject.Path & "\" & DLookup("现号", "表1", "原号='" & fileName & "'") & ".jpg"
rs.MoveNext
Next j