Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CurrentUser only to changed fields 1

Status
Not open for further replies.

Cristodul

Technical User
Mar 22, 2007
29
US
Hello
I want to create a data base with the following fields:
Old Part No; New Part No; ECN; Notes; Changed_By
This will be a daily entry by different users.
I'm using CurrentUser function to populate field Changed_By. Only problem: Is changing all the Changed_By fields in the data base. How can it change only the one was just entered?

Thank you!
 
How are you updating the field? Please post some code.
 
I was thinking to do something simple (new in using Access :)
User will manually populate field Old Part No, New Part No, ECN and Notes.
On Form Event, After Update I put =[currentuser]
The only problem is that is updating all the fields in the data base with the last user open the file.
Also I was thinking if instead of using Tools-Security menu for creating users, if I can use Windows user name, being required to log on every time you turn on the computer.
Thank you!
 
I cannot replicate this problem. I cannot see how putting =[currentuser] in the After Update event can change all the records, in fact, as it stands, I cannot see how it will work at all.

This function will return the windows log-in name.
 
Thank you for prompt response
I will look to that function.
On the Design Form I put the following:
Control Source =[currentuser]
After Update =[CurrentUser]
 
I think you will find that the table does not hold anything. Setting the Control Source to current user will only display the username, not update the table. Set the default value for the control to the function described in the link or create an event using the ... after the event name.
 
I'm sorry for being limited, but can you please tell me how to set the default value for the control function?
Yesterday it was the first time when I start Access.
I was thinking that it will be easy to do this...
 
You will find Default Value on the Data Tab of the Property Sheet.

First, vut and paste the code from the above link into a module and save the module. Make sure you do not give it the same name as the function. Next, set the default value to:
=fosUsername()

Add a record and check the table to see if all is working as you wish.
 
Is working!!!
Thank you very much for your time.
Now I have to figure out how I can block that field from being edited. Also how I can block the fields entered before for being edited.

Thank you again for your help!!!

C
 
Do not even show the field, it will still work as an invisible field.
 
Is working great!
Why every time I open the data base is at the first entry?
Can I change that to the last?
 
Yes. You can MoveLast, you can change the sort order, you can create a Data Entry form by:
[tt]* Setting the DataEntry property of the form
or
* Using VBA
DoCmd.OpenForm "frmForm", acNormal, , , acFormAdd
or
* Using a Switchboard.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top