如题目
解决方案 »
- vb ActionX 调用javascript函数报 438 对像不支持该属性或方法
- VB代码中含有中文会影响兼容之类的问题么?
- vb中导出excel表
- 请问哪位有win2000 profession 英文版的注册码?
- 在VB.Net中如何用BitBlt函数进行图片分割已完成拼图游戏
- vb 更改 Access数据库结构
- Data控件如何连接有密码的Access2000数据库,AccessXP呢?
- 简单的SQL问题?急!!!
- 如何用VB2008编写 控件随界面大小改变而改变
- 执行带参数的外部程序,参数中有变量怎么玩?
- MDI窗口背景图片问题!
- 请问在用VB调数据库时用ADO好,还是0040好,他们个有什么优缺点?
Sub GroupX() Dim cat As ADOX.Catalog
Dim usrNew As ADOX.User
Dim usrLoop As ADOX.User
Dim grpLoop As ADOX.Group
Set cat = New ADOX.Catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\" & _
"Microsoft Office\Office\Samples\Northwind.mdb;" & _
"jet oledb:system database=c:\samples\system.mdb" With cat
'Create and append new group with a string.
.Groups.Append "Accounting"
' Create and append new user with an object.
Set usrNew = New ADOX.User
usrNew.Name = "Pat Smith"
usrNew.ChangePassword "", "Password1"
.Users.Append usrNew ' Make the user Pat Smith a member of the
' Accounting group by creating and adding the
' appropriate Group object to the user's Groups
' collection. The same is accomplished if a User
' object representing Pat Smith is created and
' appended to the Accounting group Users collection
usrNew.Groups.Append "Accounting"
' Enumerate all User objects in the
' catalog's Users collection.
For Each usrLoop In .Users
Debug.Print " " & usrLoop.Name
Debug.Print " Belongs to these groups:"
' Enumerate all Group objects in each User
' object's Groups collection.
If usrLoop.Groups.Count <> 0 Then
For Each grpLoop In usrLoop.Groups
Debug.Print " " & grpLoop.Name
Next grpLoop
Else
Debug.Print " [None]"
End If
Next usrLoop ' Enumerate all Group objects in the default
' workspace's Groups collection.
For Each grpLoop In .Groups
Debug.Print " " & grpLoop.Name
Debug.Print " Has as its members:"
' Enumerate all User objects in each Group
' object's Users collection.
If grpLoop.Users.Count <> 0 Then
For Each usrLoop In grpLoop.Users
Debug.Print " " & usrLoop.Name
Next usrLoop
Else
Debug.Print " [None]"
End If
Next grpLoop
' Delete new User and Group objects because this
' is only a demonstration.
.Users.Delete "Pat Smith"
.Groups.Delete "Accounting" End WithEnd Sub
' EndGroupVB
Set db = OpenDatabase(App.path & "\test.mdb", True, False)'添加密码
db.NewPassword "", "newpwd"
db.Close