|
本帖最后由 VBProFan 于 2015-8-24 12:42 编辑
之前我一直以为 with 的设计只是为了书写代码简洁,编译器编译前会把 with 后面的内容复制到被它括起来的代码段内每个“.”开始的语句前面。但是刚才我发现我错了:- With adoFriendFilter.Recordset
- adoFriendFilter.RecordSource = "select * from tbl"
- adoFriendFilter.Refresh
- .MoveFirst
- End With
复制代码 出错: Object variable or With block variable not set.- adoFriendFilter.RecordSource = "select * from tbl"
- adoFriendFilter.Refresh
- With adoFriendFilter.Recordset
- .MoveFirst
- End With
复制代码 正常运行。
|
|