将从一个表单收集的公共变量调用到另一个表单中 [英] Calling Public Variable collected from one form into another form

查看:116
本文介绍了将从一个表单收集的公共变量调用到另一个表单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的访问编程已经生锈,我有一个问题。我的数据库要求用户在进入和搜索数据库之前登录。在这里的其他人的帮助下 - 我登录表单作为两个未绑定的组合框从
收集用户名下拉我们的员工列表然后输入密码。当我的用户输入提交时 - 用户名和当前日期和时间都存储在日志列表中。

My access programming has gone rusty and I have a question. My database requires that the user log in before they can enter and search the database. With the help from others here - my log in form as two unbound combo boxes to collect the user name from a drop down of our staff list and then to enter the password. When my user enters submit - the username and the current date and time are stored in a log list.

我的用户将根据收到和审核的内容更新记录的部分内容。  ;我设置了如果对记录进行了更改 - 它将更改存储在存档表中。 我们不是在寻找错误,而是追踪收到的物品
的进度。 我需要的最后一件事是将登录的用户附加到所做的更改中。 我已经阅读了一些关于审计表格的不同博客,但似乎无法弄清楚如何使这项工作。

My users will be updating parts of a record based on what is received and reviewed.  I have it set up that if a change is made to a record - it stores the change in an archive table.  We aren't looking for mistakes but to track the progress of an item received.  The final piece I need is to attach the user that is logged in to the change that was made.  I have read some different blogs about audit forms but can't seem to figure out how to make that work.

我认为这可以通过以某种方式存储收集的用户名来实现。登录表单作为全局变量,然后可以调用到更新记录的表单。 这听起来像是一个合理的选择吗? 
如果确实如此,我需要一个很大的帮助。它的部分内容。 或者有没有办法从日志列表中提取用户名并以某种方式使用它。

I am thinking that this might be achieved by somehow storing the user name collected on the log in form as a global variable that can then be called into the form where the records are being updated.  Does that sound like a reasonable option?  If it does, I would need a big assist on the how part of it.  Or is there a way to pull out the user name from the log list and use that somehow.

所以这是我目前卡住的地方 - 任何建议都表示赞赏!

So this is where I am currently stuck - any suggestions is appreciated!

推荐答案

一个选项,因为Access 2007,将成功登录以设置

TempVar
然后您可以在需要识别当前用户时调用它。

One option, since Access 2007, would be at successful login to set a TempVar and then you can call it whenever you need to identify the current user.

 

另一种选择是简单地使用诸如
http://www.theaccessweb.com/api/api0008.htm
,它取消了Windows登录名。 我经常做的是有一个
的用户表

Another option is to simply use a function such as http://www.theaccessweb.com/api/api0008.htm which retieves the windows login name.  What I often do is have a user table with

UserId

FirstName

LastName

NTUserName   (对应于函数结果 - 用户用来登录PC的用户名)

UserId
FirstName
LastName
NTUserName   (which correspond to the functions results - the username the user uses to log into their PC)

然后我可以随时使用NTUsername来交叉引用用户表并检索UserId用于各种跟踪表......

Then I can either use the NTUsername at anytime to cross reference against the user table and retrieve the UserId to use in various tracking tables...


这篇关于将从一个表单收集的公共变量调用到另一个表单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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