将计算机用户名存储在表的字段中 [英] Storing computer username in field of a table

查看:90
本文介绍了将计算机用户名存储在表的字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



想法是将记录中的计算机用户ID记录并存储,以便我可以跟踪创建或更改记录的用户。例如。某个用户在名为订单和订单详细信息的表格中创建报价单,我想知道哪个计算机用户创建了该记录。


目前我使用的是查询从数量和价格计算TotalPrice并通过VBA检索计算机的用户名。但每次我运行查询时,它都会调用当前用户的ID,而不会存储或保留以前的用户ID值。


这一定很简单,我无法得到它?

MikeSA

Hi
The idea is to record and store the computer user''s ID in a record, so that I can track which user created or altered the record. Eg. A certain user creates a quotation in a table called ''Orders'' and ''Order Detail'', I want to know which computer user created the record.

Currently I use a query to calculate the TotalPrice from the Qty and Price and to retrieve the computer''s username through VBA. But every time I run the query, it calls the current user''s ID and does not store or keep the previous user ID values.

This must be simple, I just cannot get it?
MikeSA

推荐答案




想法是记录并将计算机用户的ID存储在记录中,以便我可以跟踪创建或更改记录的用户。例如。某个用户在名为订单和订单详细信息的表格中创建报价单,我想知道哪个计算机用户创建了该记录。


目前我使用的是查询从数量和价格计算TotalPrice并通过VBA检索计算机的用户名。但每次我运行查询时,它都会调用当前用户的ID,而不会存储或保留以前的用户ID值。


这一定很简单,我无法得到它?

MikeSA
Hi
The idea is to record and store the computer user''s ID in a record, so that I can track which user created or altered the record. Eg. A certain user creates a quotation in a table called ''Orders'' and ''Order Detail'', I want to know which computer user created the record.

Currently I use a query to calculate the TotalPrice from the Qty and Price and to retrieve the computer''s username through VBA. But every time I run the query, it calls the current user''s ID and does not store or keep the previous user ID values.

This must be simple, I just cannot get it?
MikeSA



另一个例子是如果我有价格表更改,我想保留以前的记录反映旧的定价例如,以及使用新定价的新记录。在这两个例子中,如果我使用第一个例子中提到的查询,我需要存储计算值。(我知道这是禁忌!)

Another example is if I have a price list change, I want to keep the previous records reflecting the old pricing for example, and the new records to use the new pricing. In both examples, I need to store calculated values if I use a query as mentioned in the first example.(This I know is taboo!)



您好

我们的想法是将计算机用户的ID记录并存储在记录中,以便我可以跟踪创建或更改记录的用户。例如。某个用户在名为订单和订单详细信息的表格中创建报价单,我想知道哪个计算机用户创建了该记录。


目前我使用的是查询从数量和价格计算TotalPrice并通过VBA检索计算机的用户名。但每次我运行查询时,它都会调用当前用户的ID,而不会存储或保留以前的用户ID值。


这一定很简单,我无法得到它?

MikeSA
Hi
The idea is to record and store the computer user''s ID in a record, so that I can track which user created or altered the record. Eg. A certain user creates a quotation in a table called ''Orders'' and ''Order Detail'', I want to know which computer user created the record.

Currently I use a query to calculate the TotalPrice from the Qty and Price and to retrieve the computer''s username through VBA. But every time I run the query, it calls the current user''s ID and does not store or keep the previous user ID values.

This must be simple, I just cannot get it?
MikeSA



Mike


您需要创建一个全局变量来保存用户身份。为此,您需要在模块(而不是表单模块)中将变量声明为Public


公共用户为字符串


现在运行数据库打开时获取userID的函数,变量将在整个会话期间保存该值。

Mike

You need to create a global variable to hold the userID. To do this you need to declare the variable as Public in a module (not a form module)

Public user As String

Now run the function to get the userID when the database opens and the variable will hold the value throughout the session.



Mike


您需要创建一个全局变量来保存userID。为此,您需要在模块(而不是表单模块)中将变量声明为Public


公共用户为字符串


现在运行数据库打开时获取userID的函数,该变量将在整个会话期间保存该值。
Mike

You need to create a global variable to hold the userID. To do this you need to declare the variable as Public in a module (not a form module)

Public user As String

Now run the function to get the userID when the database opens and the variable will hold the value throughout the session.



感谢Mac,现在我如何将变量'的值插入表字段?到目前为止,我的代码如下(你提到的公共变量在此版本中尚未声明,编辑如下):

Thanks Mac, now how do I insert the variable''s value into a table field? My code so far is as follows (public variable you mentioned not declared as yet in this version, edit below):

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于将计算机用户名存储在表的字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆