Inserting Current Windows User Into Field

Mar 8, 2006

Hi Guys, my first post here

im making a database for work and need to figure out the following

i 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 Function

what 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 time
AG

View Replies


ADVERTISEMENT

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 3 Replies View Related

Queries :: Current Date Field From Form Inserting In Table

Mar 7, 2015

I have a form, has some fields, one of them is the current date, so when the user click (save )button , which make (add new record )to the only table I have the problem that .all fields are inserted in the table , except the current date !! it is a text box ( Now() )!!

View 1 Replies View Related

Tables :: Add Current User As Extra Field To Imported CSV

Aug 15, 2013

I have a table with several columns (13).

Every week i want to import a csv-file (250 records) which may or may not have been updated, say 200 are the same as previous week and 50 records are new/updated.

Is there a way to import the csv and add an extra column with who imported all of the new records (based on currentuser)?

View 1 Replies View Related

Automatically Inserting Current Time

Nov 11, 2007

I am trying to get the current time to display in the same record as an identity number.
I am using a barcode scanner to identify the ID number. Using a program called BC Wedge it will place the ID number into a field in a table of the database. I also want it to record the current time the ID number was scanned.
I tried setting the default value of the 2nd field to Now(), however this does record the current time, but in a new record. This basically gives me a list of ID numbers from the barcode scanner and a list of recorded times, however all the times are one record out.

Is there anyway to get the recorded time to be placed in the same record as the ID number?

As far as I am aware the BC Wedge software needs to have the table in table view, although I may be wrong about this.

Hope somebody can help me with this.

View 4 Replies View Related

Forms :: Goto Form With Current User And Current Date

Aug 27, 2013

What I really need is for when the form opens, it looks at todays date, then matches current user and then goes to that record for today, if no current user there, then will goto new record..

i know, sounds complicated, and probably is really easy, but my heads not with it today, as about to get drunk as its my 40th, and got people ringing and texting and still trying to get this done....

I've included a copy of this database, named Timecards..

View 1 Replies View Related

Modules & VBA :: Retrieving User Name Logged Into Windows?

Sep 20, 2013

Continuing with production of my database I've come across another wall that I'm trying to pass. My aim is when the user press the "Quit" button it will export everything to a file which is stored on Google Drive as google drive is installed on the laptops that will be using this database.

However the problem is Google drive is stored in the computer user files i.e C:UsersstudentGoogle Drive - is there a way to retrieve the name of the user that is logged into windows?

Code:

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal IpBuffer As String, nSize As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Function ThisUserName() As String
Dim LngBufLen As Long
Dim strUser As String

[code]....

However cant get this to work - I think that is probably because i'm declaring this code in the wrong place - I've tried declaring the private functions in a class module and the functions in a module - however no success - How do you set this code up? Or is there a new way to do this?

View 14 Replies View Related

Forms :: How To Capture Windows Log On Information Of A User Using Database

Apr 8, 2014

I have several data entry forms in my DB. What I would like to do is capture the windows user name of the people adding records and changing records. How do I go about doing that? I was think of an on change event to a given field that would then pull the username and insert it in another field/object.

Lets say the an on change of me.cmbModel update txtUserName.

View 5 Replies View Related

General :: Prompt A Windows Alert To All User Who Using The Same Database File?

Dec 3, 2014

Im seeking for a solution to prompt all user with windows alert for Notification

Case 1:One staff applied leave and clicked "Submit" , after clicked I want the system will prompt his/her Supervisor for his/her leave approval or like a notification that the Supervisor need to go somewhere to approve (Selected Supervisor)(Maybe the Supervisor need to 7x24 Opening the access database).

View 1 Replies View Related

Modules & VBA :: Relink Multiple BE Files / Locations Depending On User Windows Login

Mar 20, 2014

Access2007

At this point, FE db has 4 linked tables, 3 are located in FileBE1, and the 4th is located in FileBE2.

The production BE is located on a server, the test (when working remotely) is on a local computer that is not able to connect to the server. Also, the test BE files (but not the table names) have different names than the production.

I have the idea of creating a table in the Front End that contains a list of users, filename and location (server or local drive).

Upon startup, how could I set up the vba to check the links and if they need to be changed will go and change them without the user having to click on link table manager or be prompted for names and path.

For now, I envision three rows in the table, one for the test user, one for local user and a default UNC for everyone else. (or would it be six rows since there are two files that need link checking and relinking).

View 2 Replies View Related

Modules & VBA :: Linking Tables By Auto Inserting A Record Using Current Record

Aug 19, 2013

I have two forms both with separate tables

(1) Register and
(2) Payments.

One of the common denominators between them is the URN which is auto-populated as it is an auto number field. My issue is that when I want to add a new record to the payments table using the forms (I can get to the payments form via the register form), I want to be able to identify the record that I am currently viewing within the register and auto populate the URN field with the same number. This is what I have done so far,

Option Compare Database
Option Explicit
Private Sub AttachPaymentDetails()
Call PerformInsert("tblFinancialBudget", "frmFinancialBudget")
End Sub

[code]....

View 5 Replies View Related

Getting Current User ID

Apr 18, 2006

I'm creating a database for a college assignment, and for this database, I need to record the current user ID when a record is created/updated. But I dont know the function (like, Now() returns the current date/time) that gives me the user ID. The help files are awful and I cant find the function I need =(

View 2 Replies View Related

Need Current User Name

Sep 22, 2005

I need to mine the Proper Name of the current user and automatically populate a field on a form. I've tried default value = currentname() and all I get returned is Admin. How can I retrieve the Proper Name of the network username and auto populate a field? Any help is appreciated.

View 6 Replies View Related

Inserting Time Into Access 2010 Query Field When Character Is Entered In That Field

Mar 4, 2015

Here is what I am trying to do. I have a query with 2 fields. "Time In" & "Time Out". What I would like to happen is this. Whenever a character, let's say a "t", is entered into that field I would like the current time to populate that field. Right now we are actually typing in the time. I have the fields set up as DateTime fields currently.

View 10 Replies View Related

Get Username Of Current User

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

Works On Windows 2000 Not Windows 2003

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

Automatically Input Current User

Mar 14, 2008

i have a database that users log into before they can do anything, after they log in, when they open up a form, i want the username that was used to log in to be displayed and stored in a field. how would i do that?

Here are the relevant fields and tables
Name ---------------------- Description
USERS --------------------- contains username/password/success/date time for login
Login ---------------------- Login form
Username ------------------ Username field in 'Login'
Password ------------------ Password field in 'Login'
EXPOSURE_REPORT --------- Table that contains information for form VV
EXPOSURE_REPORT --------- Form
REPORTRECIEVEDBY -------- field that needs the current user stored in it


there are 6 or 7 users total, if that's at all relevant,
thanks!

View 1 Replies View Related

Current User Default When Adding A Record

Feb 22, 2005

If I have a field in a table called "AddedBy", is there a way for this to default to the CurrentUser that's logged in to the database when a record is added to the table? I know you can use "Application.CurrentUser" both in the VB code and within SQL queries, but it doesn't seem to work if I put it in the "Default Value" box with the table editor. Any thoughts on this would be appreciated. Thanks!

View 2 Replies View Related

Is The Current User A Member Of The Admin Group?

Aug 10, 2007

I am setting up a call log for an application. Once a message has been entered, I need to restrict access to the person who created it AND to managers (who have admin privelages to the database). Since the user who created a message needs to be able to go back in and edit it if necessary, I can NOT simply restrict access to the edit form to admins.

The command that opens this form looks like this so far:Code:If ((Me.[Transaction] = "Status Call") And _ (Me.[TransactionBy] = CurrentUser())) THEN DoCmd.OpenForm "frmEditMessage" ...Else MsgBox("Blah blah blah, etc etc.")End IfI need to add something to the initial If statement like this:Code:Or (CurrentUser.isMemberOfGroup("Admins"))but I don't know the correct Access syntax for it.

Any help anyone can give me would be appreciated!

View 1 Replies View Related

Modules & VBA :: Show Related Record For Current User

May 11, 2014

I was creating a program using ms access. consist of 2 table of database called employee and userlevel.. in employee table have ID, name, username, password,userlevel, and others related employee profile.. and in userlevel table, it consist of admin level and normal user level.. Userlevel table allow to differenciate admin and normal user(employee) .. in my program each employee having their own loginID and pass to access their own data.. the problem with my program now is displaying the data that belong to the logged in employee. its mean that it only show the data that owned by currently user that logged in..

View 7 Replies View Related

General :: How To Get Current User From Custom Login Form

May 2, 2014

how i can get a current user from a custom login form CurrentUser() this function always return a system user name admin as default. In my login schema i have a Hidden splash form that have a unbound field that holds user name from custom login form after login a dashboard execute and also display user name on dashboard according to user login ,this working fine for mine. Actually i want to make a currentuser stamp in every entry when a record is entered in database.

View 1 Replies View Related

Forms :: How To Allow User To Select From Current Approved Values

Jul 13, 2014

I have a combo box that needs to only show approved values for any current data input but also be able to show legacy values (that were approved at one time but are no longer approved).How can I only allow the user to select from current approved values but still be able to pull a legacy record and show the legacy value.

Table structure

tblRepairReason
ID (Nnumber)
Name (Text)
ApprovedValue (Yes/No)

The recordsource of the combo box:

Code:

SELECT tblRepairReason.ID, tblRepairReason.Name, tblRepairReason.ApprovedValue
FROM tblRepairReason
WHERE (((tblRepairReason.ApprovedValue)=True));

View 14 Replies View Related

Inserting A New Field With A Fixed Value

Oct 19, 2004

How do I add a new field to an existing table so that the same value is automatically entered for all the records in that new field.

View 1 Replies View Related

Access And Windows 98 To Windows 2000

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

General :: How To Write Sample Code To Retrieve Current User Name

Sep 25, 2013

How to write Sample Code to Retrieve the Current User Name?I have done for short name only and I need it full

Private Declare Function apiGetUserNameWindows Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
Dim lngLen As Long, lngX As Long
Dim strUserName As String

[code]....

View 1 Replies View Related

General :: Saving Program To Current User Documents Folder?

Aug 31, 2014

I have an access program and i want it to save a copy into a location... ive got it so it can save however - i want it to save to the current users documents folder (win 7)

What file path would i use?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved