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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding computer name to a form/table

Status
Not open for further replies.

turks393

Technical User
Dec 7, 2006
13
0
0
US
Can the computer name be added to a hidden field in a form upon entry or exit of another field? For example... if you are entering data into bunch of fields, you are tabbing through once you enter or exit a date field the PC name gets entered into a hidden field and stored in the table. I am also looking for a time and date stamp to do the same thing.
Thanks!
 
You can use code in the before update event of a form to put values into bound controls like:

Me.txtDateTime = Now

There are functions that you can use to retrieve the network login and the PC at
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
turks393,
Yes, you can use [tt]environ$("COMPUTERNAME")[/tt] to capture the computer name.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
I wouldn't use the Environ variables since they are not reliable in all Windows operating systems and with all users. API calls are much more robust.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top