Access编程交流网
  • 设为首页|收藏本站|繁体中文|手机版
  •     
  • Access培训-Access开发平台-Access行业开发

  • 首页
  • 资讯
  • 技巧
  • 源码
  • 行业
  • 资源
  • 活动
  • 关于

技巧

ACCESS数据库

启动/设置/选项/背景

修复/压缩

安全/加密/解密

快捷键

版本升级/其它等

数据表

命名方式/设计规范

表设计

查询

Sql语言基础

选择查询

更新查询

删除查询

追加查询

生成表查询

交叉表查询

SQL特定查询

查询参数

查询综合应用

界面/窗体/控件

标签

文本框

命令按钮

组合框/列表框

选项组/复选框/选项按钮

选项卡

子窗体

窗体本身/综合应用

其它

报表打印

报表设计

高级报表

模块/函数/VBA/API/系统

VBA基础

内置函数

调试/跟踪/Debug

模块/类模块

API/COM/系统相关

字符数字日期

网络通信游戏

加密解密安全

文件处理

经典算法

宏/菜单/工具栏/功能区

宏/脚本

菜单/工具栏

功能区/Ribbon

图表/图形/图像/多媒体

图表

图形/图像

音频

视频/动画

DAO/链接表/ADO/ADP

DAO/链接表/ODBC

ADO/RDO

ADP

ActiveX/第三方控件/插件

Treeview树控件

ListView列表控件

Toolbar工具栏控件

微软其它控件

Dbi-Tech

CodeJock

Grid++Report

FastReport

ComponentOne

加载项/插件/Addin

OFFICE集成/导入导出/交互

Excel导入导出/交互

Word导入导出/交互

PPT交互

Outlook控制/邮件

Text文本文件/INI/CSV

PDF/SWF/XML格式

CAD格式

Sharepoint/其它Office

SqlServer/其它数据库

表

视图

存储过程/触发器

函数

用户/权限/安全

调试/维护

SqlServer其它/综合

发布/打包/文档/帮助

开发版/运行时

打包/发布/部署

开发文档/帮助制作

Access完整行业系统

采购管理系统

销售管理系统

仓库管理系统

人力资源管理HRM

CRM管理系统

MRP/ERP管理系统

BRP/流程优化

其它管理系统

心得/经验/绝招
其它/杂项
Excel技巧

Excel应用与操作

Excel开发编程

Word技巧

Word应用与操作

Word开发编程

Outlook技巧

Outlook应用与操作

Outlook开发编程

热门文章

  • 运行操作查询词句更好的方法
  • 处理加了密码的MDB文件
  • 通过字段名来获取字段标题的..
  • ADP项目中创建ADP的数..
  • 用VBA代码+DAO生成带..
  • Access数据库手动添加..

最新文章

  • 实验报告 --DAO与AD..
  • 用代码创建mdb格式的Ac..
  • 连接后台数据库提示 无法启..
  • 64位windows系统如..
  • Access的DAO准确获..
  • 利用代码自动创建ODBC源

联系方式

Access交流网(免费Access交流)

QQ:18449932 

网  址:www.access-cn.com

当前位置:首页 > 技巧 > DAO/链接表/ADO/ADP
DAO/链接表/ADO/ADP

使用Jet UserRoster判断谁登陆了Access2002/2003数据库

原文:http://support.microsoft.com/kb/285822

How to determine who is logged on to a database by using Microsoft Jet UserRoster in Access 2002 or in access 2003

Article ID : 285822
Last Review : August 30, 2004
Revision : 1.0
This article was previously published under Q285822
For a Microsoft access 2000 version of this article, see 198755.

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft access database (.mdb).

IN THIS TASK

• SUMMARY
 
• Procedure

SUMMARY

This article shows you how to use Microsoft Visual Basic for Applications to output a list of users who are logged onto a database.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, visit the following Microsoft Web site:
http://directory.microsoft.com/resourcedirectory/Solutions.aspx
For additional information about the support options available from Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS
When you use the following sample code, the following information is returned:
• Computer name.
• Logon name.
• Whether or not the user is currently connected to the database. (A user's ID remains in the lock database until the last user disconnects or until the slot is reclaimed for a new user connection.)
• Whether or not the user connection was terminated under normal circumstances.
This information can also be used to isolate problems with database corruption that is associated with the activities of a specific user.

back to the top

Procedure

To determine who is logged onto a database, follow these steps:
1. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

2. Open the sample database, Northwind.mdb.
3. On the View menu, point to Database Objects, and then click Modules.
4. Click New.
5. Type or paste the following code:
Sub ShowUserRosterMultipleUsers()
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim i, j As Long

    Set cn = CurrentProject.Connection

    ' The user roster is exposed as a provider-specific schema rowset
    ' in the Jet 4.0 OLE DB provider.  You have to use a GUID to
    ' reference the schema, as provider-specific schemas are not
    ' listed in ADO's type library for schema rowsets

    Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
    , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

    'Output the list of all users in the current database.

    Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
    "", rs.Fields(2).Name, rs.Fields(3).Name

    While Not rs.EOF
        Debug.Print rs.Fields(0), rs.Fields(1), _
        rs.Fields(2), rs.Fields(3)
        rs.MoveNext
    Wend

End Sub
					
6. Save the module as ShowUsers.
7. Close and then reopen the database.
8. Press CTRL+G to open the Immediate Window.
9. Type the following line in the Immediate window, and then press ENTER:
ShowUserRosterMultipleUsers
					
Note that the Immediate window returns a list of users who are logged onto the database.
back to the top

APPLIES TO
• Microsoft Office access 2003
• Microsoft access 2002 Standard Edition
• Microsoft Visual Basic for Applications 6.0
Top of Page Top of Page
Keywords: 
kbhowtomaster KB285822
Top of Page Top of Page
发布人:Microsof…-Microsoft  
分享到:
点击次数:  更新时间:2005-02-06 02:02:32  【打印此页】  【关闭】
上一条:查询在不同Web服务器上的数据库  下一条:Access如何使用ADO或DAO获取字段的描述属性(KB)



相关文章

  • • 实验报告 --DAO与ADO效率之比较
  • • 用代码创建mdb格式的Access文件
  • • 连接后台数据库提示 无法启动应用程序。工作组信息文件丢失,或是已被其它用户以独占方式打开 的解决办法
  • • 64位windows系统如何使用64位的ADO连接Accesss accdb数据库(ACE.OLEDB)
  • • Access的DAO准确获取记录集Recordset的记录数Recordcount
  • • 利用代码自动创建ODBC源
  • • 在打开Ado记录集之前尽量先判断记录集有否打开,如打开则先关闭之
  • • 快速获取Excel文件所有工作表表名

热门文章

  • [2005-02-06] 如何更改Access表的字段名access数据库
  • [2014-01-02] Access开发网络共享版技巧(多人同时操作)access数据库
  • [2005-02-06] 查询在不同Web服务器上的数据库access数据库
  • [2004-11-23] 一句代码得到SQL SERVER时间的函数access数据库
  • [2003-12-12] ADO连接数据库字符串大全(E文)access数据库
  • [2018-08-06] 实验报告 --DAO与ADO效率之比较access数据库

热门产品

公司动态|在线留言|在线反馈|友情链接|会员中心|站内搜索|网站地图

中山市天鸣科技发展有限公司 版权所有 1999-2023 粤ICP备10043721号

QQ:18449932

Access应用 Access培训 Access开发 Access平台

access|数据库|access下载|access教程|access视频|access软件

Powered by MetInfo 5.3.12 ©2008-2025  www.metinfo.cn