对记录集adoRs进行筛选,直接用字符串‘MXD-16F-B’作过滤条件没问题:
) o* e" Q9 H% }% U7 v( p! M% N
. K2 k9 d6 T; e* _ 1. adoRs.Open "零件表"3 Q' p, `# w# {4 m; c; A% @
2. adoRs.Filter = "型号='MXD-16F-B'"
! y: O- T A! A2 s# R/ N' L" Z1 a v$ n( C' b
但用变量引入条件则出错:
) b: G3 N3 Z% b2 M+ e- H
( f" k0 j4 B. t1 y 1. adoRs.Open "零件表"7 f9 E5 x! ]# @( K4 R' m6 U
2.8 B, H( T8 d3 l
Dim ljb As String
# L! z2 o1 v# z3 C$ U" F+ a 3. ljb = "MXD-16F-B"
W' T0 p z5 Q+ o2 E 4. adoRs.Filter = "型号=" & ljb '或者用adoRs.Filter = "型号=ljb"也出错
) i0 d7 U8 u6 ~! }3 {2 _
3 f8 |, T* h2 H. P. c. d8 @报“参数类型错误” (3001)* e0 x( ]5 w# n4 s6 I! L
/ ^# E4 u% _) P% a" I" K( R" \7 F请教是何原因?怎解?谢谢! |