a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 90|回复: 0

[Access] 如何设置组合框或列表框的行来源为函数(2)

[复制链接]
发表于 2012-7-31 22:26:35 | 显示全部楼层 |阅读模式
如何设置组合框或列表框的行来源为函数(2)
) Y9 r. l; b  D- y  X5 x1 FReDim svarArray(sintRows, sintCols)
+ V7 h7 q4 R; H4 X3 u  For intLoopRow = 0 To sintRows - 1
9 j1 w: y8 ?) {! u1 O  svarArray(intLoopRow, 0) = RST(0)! _5 ~9 u# w3 P% q7 s2 \* R
  svarArray(intLoopRow, 1) = RST(1)8 q; C) `% D8 ^' M0 D7 S
  ' MsgBox rst(0) & rst(1)
8 [! I* H- Q4 w0 L* K0 X  RST.MoveNext( Z, V3 n& ?+ Y% |2 E0 X0 ]8 @
  Next
' s( q/ s# z* u# ?1 ?  RST.Close! C0 H# Y' b! W- X* ~
  End If
; C, j5 N6 F5 z: s6 ^+ S  varRetVal = True) K  p# v: a, f, K0 ~9 ~* x
  Case acLBOpen '1
# C- C4 s  Q+ Z6 i  'return a unique ID code
0 q! W  ]3 I5 U2 _! s1 @  varRetVal = Timer5 a# Y% B: a$ v0 L: r8 T
  Case acLBGetRowCount '3
+ P% k$ \# s# w- ]  I$ J& G4 a  ' Return number of rows
' a/ Y: Y& W" ?! B/ W8 N  varRetVal = sintRows! ^, \4 P; h3 T7 _5 K. M; D/ ?7 D
  Case acLBGetColumnCount '4
3 S) B) X9 Q' _$ _* X0 Z6 N( E  ' Return number of fields (columns)
+ |( B0 \1 O8 B$ @  varRetVal = sintCols
2 w+ H. q3 _  l" E  Case acLBGetColumnWidth '5
: N; n" l" H- S5 H  e! l6 o1 W  'return the column widths or# i/ {, O; l! I4 ]
  '-1 for the default width for the column
2 S4 H8 r/ |6 G  ' varRetVal = -1 'default width# Q) O( Y5 z( X
  Select Case lngCol
5 n( _0 O7 ~7 H- A* i/ q  Case 0
4 G7 \2 X9 \6 B) q; l  'hide the first column& N5 }; E1 J( a, O
  varRetVal = 0! P7 H  ^( A6 v+ p' i  a  P
  Case 1
- z& W1 C$ M) i0 g  'return the default width for column 2
+ p  l6 m6 b3 Q  varRetVal = -11 Q- N1 E* {1 U8 ~4 n( Y
  End Select
, f' u) ~! l* I/ }' z2 W9 f0 C  Case acLBGetValue '6; n" T' Z1 q( w6 ~, L
  'Return actual data2 v* ~& R$ |" o) ^
  varRetVal = svarArray(lngRow, lngCol)$ j5 }' `; z& J9 _7 }% W
  'If lngRow = 0 Then  F! f$ [6 [" l, U8 _. y/ [
  'varRetVal = Null) ?  P& W8 O5 P/ s* t4 |8 G# z
  ' End If
: m) \: E3 q5 }: ?  Case acLBGetFormat '7
' L" H6 J2 H$ \4 C6 \$ ]# u7 r  'return the formatting info for the row/column
/ P3 ~% i( a# z% s& Y* Q  Select Case lngCol
" P  w$ d: `8 V  Case 05 X5 _1 l2 O% c& Q
  Case 1
" _" l. m  }' q4 U- y3 ^, f& w  End Select
  A/ e; ]$ s3 ~$ G  Case acLBEnd '9
6 W* P% ]$ M9 U  'clean up
1 j  Q8 m' D- P* J8 h0 v  On Error Resume Next
2 _/ U) Z9 ^; T3 I  Erase svarArray6 i/ s3 k) J& H8 d) A3 R
  Set RST = Nothing. E2 E8 ~2 d9 ]) _
  Set cnn = Nothing# ~" T' c. N! g6 D
  End Select8 {' }! R# q/ i; i, d( O1 x- \
  Proc_exit:* R# [% F7 G4 ?& y" x% S" c) r4 h
  On Error Resume Next
  u" y: t8 o% u0 }0 w+ [" q4 R7 f  valueList = varRetVal- t' |; P1 u  W. ^! }' `, r
  Exit Function
& _% f7 ]& C1 y! U# e$ [" I: Z  Proc_err:5 [% R4 V1 w: L/ Y: @
  'MsgBox Err.Number & "--" & Err.Description & vbCrLf & "CustomerList"0 X1 n4 C6 F7 r* c
  varRetVal = False! _0 V/ k- [4 S- M( j0 _  P( f
  Resume Proc_exit% x! h1 [# C( h: n' N) c
  End Function
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-4-29 14:03 , Processed in 0.249555 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表