注册 登录
Office中国论坛/Access中国论坛 返回首页

todaynew的个人空间 http://www.office-cn.net/?144436 [收藏] [复制] [分享] [RSS]

日志

数组运用习作

已有 716 次阅读2009-2-16 17:54 |个人分类:习作|

Private Sub Command2_Click()
Dim rs As New ADODB.Recordset
Dim sql As String, sqlf As String
Dim strf(10) As String
Dim i As Long, j As Long
sql = "select * from temp"
rs.Open sql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
i = 0
Do While Not rs.EOF
    i = i + 1
    strf(i) = rs!材料
    rs.MoveNext
Loop
sqlf = ""
For j = 1 To i
    sqlf = sqlf + strf(j) + " text" + IIf(j = i, "", ",")
Next
sqlf = "(" + sqlf + ")"
CurrentDb.Execute "CREATE TABLE " & Me.Text5 & sqlf
End Sub
 

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-13 01:19 , Processed in 0.085958 second(s), 17 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部