|
[em05]
我看看....
楼主的代码好像有点乱哦....
把这部分代码改一下就可以了....
Dim re As DAO.Recordset
Dim strSQL As String
Me.Requery '保存记录
'==================生成SQL语名部分============================
Set re = CurrentDb.OpenRecordset("Select biaoti From 是否显示 Where xianshi=True")
With re
If .RecordCount <> 0 Then
strSQL = !biaoti
.MoveNext
Do Until .EOF
strSQL = strSQL & "," & !biaoti
.MoveNext
Loop
End If
End With
strSQL = "select " & strSQL & " From base"
'==================创建查询表部分============================
Dim QryName As String
QryName = "basexuan"
On Error GoTo ErrHandle:
CurrentDb.CreateQueryDef "tmpQryDef_" & QryName, strSQL
DoCmd.Close acQuery, QryName
CurrentDb.QueryDefs.Delete QryName
DoCmd.Rename QryName, acQuery, "tmpQryDef_" & QryName
DoCmd.OpenQuery QryName
'=====================捕捉错误部分==========================
Exit Sub
ErrHandle:
Select Case Err.Number
Case 3075
MsgBox "生成的SQL语句出错!" & vbCrLf & Err.Description
Case 3265 '查询对象不存在
Resume Next
Case Else
MsgBox Err.Description
End Select
文件怎么上传不了呀...更外也不能改帖...谁可以友情一下,我用的是firefox.
|
|