标题: 判断一个字段是否在表中的函数
问天
元帅
Rank: 1


元帅勋章 终身成就勋章
UID 11493
精华 186
积分 34130
帖子 33347
威望 88
金币 13137
热心 2611
阅读权限 100
注册 2006-4-7
状态 离线
判断一个字段是否在表中的函数

'判断一个字段是否在表中
Function BlnField(sTblName As String, sFldName As String) As Boolean

'sTblName 源表名
'要查找的字段名
Dim fld As Field
Dim rs As DAO.Recordset

BlnField = False
Set rs = CurrentDb.OpenRecordset(sTblName)
rs.Fields.Refresh
For Each fld In rs.Fields
If fld.Name = sFldName Then
BlnField = True
Exit For
End If
Next
rs.Close
Set rs = Nothing
Set fld = Nothing
End Function      
Private Sub 命令0_Click()
'返回True则有此字段,False则无
MsgBox BlnField("tbl1", "ID")
End Sub


网友 问天 签名 - 网友社区 请您回个帖。谢谢
PR查询 免费域名 免费空间
顶部
[广告] 免费域名(Free Subdomain) 免费空间(Free hosting) PR查询(Google Pagerank)



当前时区 GMT+8, 现在时间是 2008-9-6 01:24
信产部ICP备案:京ICP备05066424号 北京市公安局网监备案:1101050648号

Powered by Discuz! 5.5.0
清除 Cookies - 联系我们 - 网友俱乐部 - Archiver - WAP