Record Current Windows Username In Audit Field
Jun 11, 2012
I am trying to record the current windows username in an audit field. But all i can get is the Username Admin?
Dim MyForm As Form, C As Control, xName As String
Set MyForm = Screen.ActiveForm
'Set date and current user if form has been updated.
MyForm!Audit = MyForm!Audit & Chr(13) & Chr(10) & _
"Changes made on " & Now & Date & " by " & CurrentUser() & ";"
[Code] ....
View Replies
ADVERTISEMENT
Nov 1, 2013
I am having a difficult time figuring out how to have a table add a new record that includes the Windows username of the user that clicks the button on my form. The function is in place that pulls the Windows username:
Code:
Public Function getWinUser() As String
getWinUser = Environ("UserName")
End Function
I then call the function during the button click by simply adding getWinUser. Unfortunately, all that occurs is that the same record gets updated instead of creating a new record.
View 14 Replies
View Related
Jul 25, 2006
A couple of questions. I want my database to query the AD and make sure that the user trying to open the database had an account in the AD. I dont want them prompted for a password though. I have had a look at trying to change the example NT logon in the samples area, but just managed to get myself in a bit of a mess. Also is there anyway that you can query the users full name in AD and call that variable,or does this only work with the username?
Also, when a user created a record in a from, I would like the users username, called from the AD saved in a field in the table. I have tried this and the only way that I can call the variable is by having the "=Environ("USERNAME")" in the control source of the text box. Which means that it cant be save in a field in the table. I have also tried an after updated event on that textbox to update another textbox and have that textbox control source a field on the table. But again this doesn't work. Can someone tell me if what I am trying to do is possible. Thanks
View 1 Replies
View Related
Mar 8, 2006
Hi Guys, my first post hereim making a database for work and need to figure out the followingi have two people that uses a ms access db, each entering data.i made a custom macro in the vb editor:Public Function cUsername() cUsername = Environ("USERNAME")End Functionwhat i want to do now is, everytime a new entry is added in the table, it should add that username to the "user" cell... it should only do this once, so for example, when i enter data it will show "albert" and if i was to close it, login as "steve" it should still show "albert" under the ones i added, and not steve...this needs to be in the table not a query or form...thanks for your timeAG
View 2 Replies
View Related
Oct 23, 2005
Hi
I have designed a MS Access tool accessed by multiple user. The first screen asks for badge number which is unique for each user. I wanted to do away with that screen. Instead wanted to get the username of the currently logged in user, may be from registry or somewhere. We have Windows XP here. Is there any VBA script for that....Need help!!
View 5 Replies
View Related
Jul 10, 2015
I'm creating an Audit form with a combobox from which the employee name performing the audit can be selected. The data source is the EmpNames query which selects from the Employees table, linked to another database. The EmpNames query includes a record selection criteria where Employees.TermDate is null so that terminated employees will not appear in the dropdown list.
This is fine as audit records are being added in the form for current employees, but in the future, if an employee is terminated and we go back to one of his audit records, the name will be blank because EmpNames won't include it. The Audit table doesn't store the employee's name -- just his employee ID, and the combobox has a two-column data source where the column 1 width is 0 and column 2 is the name. Is there a way to have only current employees be selectable but still be able to see terminated employees in existing audit records?
View 4 Replies
View Related
Apr 30, 2007
I need a way to dynamically store a particular value in "field_2" of the CURRENT record depending on whether or not the value of "field_1" of the CURRENT record is identical to the value of "field_1" of the PREVIOUS record within the same table. The table is sorted on "field_1".
So, if the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is also "ABC", then store a value of "PPP" in "field_2" of the current record. IF on the other hand, the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is "XYZ", then store a value of "WWW" in "field_2" of the current record.
I have a report that will use these results to count only the number of records that have a "WWW" in "field_2".
Is this doable, maybe in a query somehow?
I should add that whatever the solution, it needs to be compatible with Access 2000.
View 1 Replies
View Related
May 1, 2013
I have a query to bring in values, I need to select 2 rows of data but the criteria is as such:
x= starting value on form
now the row of data must match the following criteria previous row to current row(ref temp)<=x And Current row(ref temp)>xnext row to current row(ref temp)>=x And Current row(ref temp)<x
I have dealt with SQL before but how to do the above.The isolated 2 rows of data will then go into unbound boxes on a form from which I will do intercept and gradient calculations.
View 5 Replies
View Related
May 9, 2005
Have developed a support database in Access.
I need the dB to automatically pick up the username of the user logged on to the PC. Thus if I'm logged on to the PC as FLESTER, this username wil populate a database field.
Any ideas?
View 1 Replies
View Related
Jul 26, 2005
How do you get Access to pick up th OS username currently logged in to the database? For example I'm logged on to the PC as FLESTER and I wnat that recorded in the dB.
View 5 Replies
View Related
Nov 29, 2005
I have a form where there are many users to enter or update data. I need to capture the username who created a record , then , on form load , I want system to check for username if it is same as the creator of a record , then allow update , otherwise don’t allow update , but allow only adding new records. How can I do this
View 3 Replies
View Related
Jul 19, 2013
My problem is related to an Access database, where an auto complete Combo box is used to select a client record by entering the ID number or the clients name. EG: 14034 or Bloggs,Fred. This problem has me puzzled (not difficult to do).I have seen this in a functioning DB. I can see that maybe the ID (a long integer) would have to be stored or converted to a string on the fly.
I am currently using Access 2007 but 2010 and 2013 are available (prefer 2007 as MS keep moving things around ).I am currently selecting a client record using either an ID select Combo or a ClientName Combo and works very well. But, after seeing it done in one Combo box, it just seems so elegant.
View 1 Replies
View Related
Nov 26, 2013
I have a field that records comments call house comments i wonder is it possible to record which user leaves what comment?
Code:
=ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([txtID],0))
View 1 Replies
View Related
Jul 30, 2014
I need a simple audit capability
I have a table (Called Master Active List)
I have an empty duplicate of it called History of Master Active List. (Identical fields, with the addition of a distinct ID (primary key)
I have a form where the master can be changed (Called customer details)
When any change is made I want to post the whole record to the history table
1 - Am I correct I no longer need a form based one,(office 2013) and can do one on the data table itself?
I want to capture everything, can this be done with a wildcard, or do I need to go line by line?
The master table has a ton of fields.
View 3 Replies
View Related
Dec 26, 2013
I am still new to Access code.
I was wanting to know if there is a way to Add the Username to a table as a default value when a new record is added. I know you can add =Date() to get the date. Is there a simple way to get the ID of the person logged into Window?
View 6 Replies
View Related
Jul 28, 2014
in a continuous form i want to click on one record and have the one field change the background colour to highlight it. When I use the code: Field. BackColor = vbYellow it changes the background on all the records. Is there a code to say only for the record with focus?
View 1 Replies
View Related
Sep 20, 2013
I would like to do a loop but never done one before, basically i want to copy the current record by the number of times specified in a quantity field
So if the quantity field in the record says 5 then copy that record 5 times (I have managed to create the copy and paste code but dont know how to make it do it 5 times
Code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdPaste
View 2 Replies
View Related
Apr 24, 2015
After a lot of reading and consolidating VBA codes for audit trail.How My Audit Trail Works..A module was made for a function named as "Changes" .Then inserted into before update event of a form where I will do the editing of the records.Then I made a table named as Audit.Inside this table I made all the fields I needed such as:
*AuditRecordId[autonumbered]
*FormName[The name of the form for editing]
*Index[The record ID of the record being edited]
*ControlName[The Field being edited]
*DateChanged[Date change was done]
*TimeChanged[Time change was done]
*PriorInfo[for the old value of data being changed]
*NewInfo[For the new value of data changed]
*CurrentUser[The user base on log in form that was set to Global into another module]
*Reason[The reason for changing for future references]
And Here is the Function Code:
Code:
Option Compare Database
Option Explicit
Function Changes()
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim strCtl As String
Dim strReason As String
[code]....
This audit trail function is valid only for one(1) form, due to the limitation of
Code:
Screen.ActiveForm.Controls("SUP ID").Value
where "SUP ID" is the primary key of the record being updated/Change, so if there are Five(5) tables that needs audit trail, there will be also Five(5) forms, as well as Five(5) Function Changes namely; Changes(), Changes1(),Changes2(),etc... because all the table do have their own sets of primary Key.
Is there a shortcut, in such a way that the "rs!Index" will automatically return a value, equivalent to the Primary Key/Record Id of the record being updated/change, given that there are different updating forms for each table to be updated?
View 5 Replies
View Related
Aug 1, 2014
I am trying to match if a user has already started a record using the date and username. I have written the following code but I keep getting a error 94 about null. I know its an issue involving the date part. why this isn't working.
Code:
DLookup("TimeSheetID", "TimeSheet", "EmployeeID=" & Nz(Me.ListEmploy.Value) & " AND TimeSheetDate=#" & Date2 & "#")))
The full code
Code:
Dim Date2 As Date
Date2 = Date
If (Not IsNull(DLookup("TimeSheetID", "TimeSheet", "EmployeeID=" & Nz(Me.ListEmploy.Value) & " AND TimeSheetDate=#" & Date2 & "#"))) Then
lngEmployeeID = DLookup("TimeSheetID", "TimeSheet", "EmployeeID=" & Nz(Me.ListEmploy.Value) & " AND TimeSheetDate=#" & Date2 & "#")
DoCmd.OpenForm "frmTimeSheetMain", , , "TimeSheetID=" & Nz(lngEmployeeID), , , "NoTimeSheetID"
View 5 Replies
View Related
Nov 27, 2013
I have been using Access for quite some time now and I am able to usually work around many of the issues that come with being a small timer, like me, taking his best shot at Access; however one issue I have had absolutely no luck with is auditing a new and/or change made to an "Attachment Field". I have successfully been able to audit every type of field with the exception of the "Attachment Field".
View 7 Replies
View Related
Apr 8, 2013
I wish to change the backcolor of a field on a current record being dispalyed in a 'multiple items' form. However when using me.A.backcolor = makes refrence to all fields called A on the 'multiple items' form and therefore all fields change colour not just the current record.
View 2 Replies
View Related
Dec 20, 2006
Hi every one
i have an application with an audit trail module, i do read the table name , field name,old value, new value. but the lables of the fields at my forms are changed to arabic language
for example
lets say i do have a table
the name of one field is Name
on the form the label of this field is Lawyer Name
now the client is asking me to show the ( Lawyer Name ) not the field name ( Name ) in the audit trail to know the changes were made.
I thought to go to the tables and on each field 's caption i shall add in arabic the same as in my form
I am trying to read the caption of the field from the tables
i hope you understood what i mean
if you show me the code to do that , it would be highly appreciated
thanks in advance
View 5 Replies
View Related
May 20, 2014
I have a form containing two memo fields - Fld_Note and Fld_History.
What I was aiming for is that when someone enters info into Fld_Note, that either automatically when they leave the form - or when a button is pressed - the text from Fld-Note is copied to Fld_History and date stamped.
Any future notes are also date stamped and appended to the info in Fld_History (ideally most recent first) so that users have an audit trail in Fld_History of what notes have been added and when e.g.
20-05-2014 Contacted group treasurer regarding transfer of funds.
19-15-2014 Application for grant funding approved.
12-05-2014 Grant application received.
View 3 Replies
View Related
Dec 4, 2005
Hi,
I developed a database in Access 2000 on an XP SP2 machine with linked tables to another Access 2000 database.
Everything works fine using my machine, but when a user running Windows 2000 uses the database, they cannot add a new record to the linked table (either directly using the datasheet or a form). Running a query on the table also did not let me add a new record.
I have searched the MSDN libraries, but I wasn't able to find anything.
Any help much appreciated.
View 1 Replies
View Related
Sep 19, 2006
I have a website that is asp (not .net) based with an Access DB and I am in the process of replacing an old windows 2000 server with a much faster windows 2003 server. Here lies the problem I have a script as part of the admin that exports data to a csv file. The query joins 4 tables together to get the data needed for the export. On the windows 2000 server it takes 1-5 seconds to execute and have the csv file ready for download. On the window 2003 server it times out. I striped it down to use 2 joins and it worked although it took more like 10-20 seconds to export. This exports a specific range of ID's and the range is normally only 40-50 rows. If I put time stamps in the code the problem is in the query of the database, so I know its not in the file write etc.
I am going to rewrite it to use multible querys instead of one large query, but I have many other sites that I am moving to this server that would work better if I can figure out why it is so slow.
The windows 2000 is a 900 mhz server the windows 2003 is a 2.8GHZ server both have 1 GIG of ram. The database file is on the local drive on both servers. I am guessing it is a difference in the Jet version, I just haven't been able to find a solution to the problem. This uses a DSN connection, configured the same on both servers. I have also tried it as a DSN-less connection with the same result.
I have installed access on the server and to execute the command in access it is <2 sec.
I am not an access expert I normally program in .net and php and use MySQL and MsSQL for databases, we just have these legacy sites that use Access DB's
View 1 Replies
View Related
Nov 27, 2006
Hi All,
This is my problem -
My customer has Access programs that work on their Windows 98 OS PC's, but when they try to use them on Windows 2000 OS PC's they will not work.
The programs I believe were originally written in Access 97 and now they have Access 2000 on the PC's.
By not working I mean the following -
The Access program allows them to enter a document name and then the file opens in Word - BUT - when they use it in Windows 2000 it does not open the document at all. It says file not found in Windows 2000 and the file does exist.
** The reason they have Access opening files is that Access keeps track of them for auditing purposes.
Now here is something that I want to mention. On PC's that were upgraded from Windows 98 to Windows 2000 the programs work.
Can anyone here tell me what is missing from 98 to 2000 that would do this.
Thank you very much for your time.
View 3 Replies
View Related