对记录集adoRs进行筛选,直接用字符串‘MXD-16F-B’作过滤条件没问题:
; L; y+ w7 S: x( X9 z! a3 q& t
! U% Y! j! @1 m. K* M- o% x* A 1. adoRs.Open "零件表"
2 p0 v# o1 V$ j" h- ^: @+ J 2. adoRs.Filter = "型号='MXD-16F-B'"
7 }1 U* d/ Y: N# v. A4 y$ e
0 N! ~* J0 V+ m5 V! p. h0 @但用变量引入条件则出错:
, y( z5 ^5 |% i4 j
! ^! \' W( A- s( [: X 1. adoRs.Open "零件表" j0 r/ E1 i4 e# m8 p. T
2.( F8 R5 T% J0 M1 W
Dim ljb As String3 ^% a9 e7 X1 _) ~, P
3. ljb = "MXD-16F-B"9 C& i- L7 T( k; t$ L O/ n
4. adoRs.Filter = "型号=" & ljb '或者用adoRs.Filter = "型号=ljb"也出错: f9 X+ L7 o' n* i0 P& C
" A% y) u8 J! x
报“参数类型错误” (3001)2 F# ?. y/ c- [
# j, M8 [1 ]9 I1 q" C请教是何原因?怎解?谢谢! |