find user's computer name

Hi all, I got macro below which tell me user's computer name who is
logged on in current database.  What changes I do in below macro that
it should tell me the user's machine name who is logged on in the
database which is on path "C:\Documents\Record.mdb".  Please can any
friend can help

Private Declare Function apiGetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Function fOSMachineName() As String 'Returns the computername


    Dim lngLen As Long, lngX As Long
    Dim strCompName As String
    strCompName = String$(16, 0)
    lngLen = 16
    lngX = apiGetComputerName(strCompName, lngLen)
    If (lngX > 0) Then
        fOSMachineName = Left$(strCompName, lngLen)
    Else
        fOSMachineName = vbNullString
    End If
End Function


0
K
12/8/2009 4:27:06 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
1081 Views

Similar Articles

[PageSpeed] 13

Try

ComputerName = environ("ComputerName")


It is one of the environmental parameters which you can see by opening
a DOS window and typing SET at the prompt


Start - Run
type CMD.EXE
at dos prompt type > SET

From Vista 
Start - Search - CMD.EXE
at dos prompt type > SET

Each of the variables in that are returned can be obtained using the
environmental command in VBA,


-- 
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=160666

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]

0
joel
12/8/2009 4:37:21 PM
Reply:

Similar Artilces:

Multiple Users #4
My scenerio is - we have 10 warehouse workers that log on to 1 PC with a common logon. I would like to give each of them their own secure mailbox that they can access, without logging out of Windows 2000. I have created accounts for each of the users, as well as profiles on the PC. When the user tries to login, there is a prompt for ID/PW and Domain. After entering the info - an error appears saying that the user does not have permission to access the mailbox. We are using Outlook 2000? Any help would be greatly appreciated. ...

Print a user form image
I learn how to print a text as follows Private Sub CommandButton3_Click() Dim intOutFile As Integer 'number for the output file intOutFile = FreeFile 'get a file number Open "c:\temp\temp.txt" For Output As intOutFile Print #intOutFile, Print_Dev.TextBox1.Text Close intOutFile Shell "c:\windows\notepad.exe /P c:\temp\temp.txt" Kill "c:\temp\temp.txt" 'delete the file if desired End Sub Now I would like to print an image as well... I tried modifying this Print #intOutFile, Print_Dev.TextBox1.Text ...

Filters, Can't Find Exception List In Rules
I'm trying to set up my filters for junk mail. I want junk mail with certain words in the subject sent to deleted folder. I found the filters.txt file and some of the words are already there. So apparently the filter isn't working. I tried to follow the directions on how to turn them on and they said to choose the exceptions entry in the rules wizard but I have no such choice. I know how to edit the filters.txt file but Outlook is not using it. Can anyone help? The Filters.txt file isn't actively used by Outlook -- it's really just a "readme" type file to sh...

scripting adding obj-users and mdb-use-defaults to exchange 5.5 users
I have successfully created a script for creating exchange 5.5 users. I can't however, figure out how to add the assoc-nt-account to the obj-users [pseudo attribute] or set MDB-Use-Defaults to True :-( Can anyone offer advice on how to do this [other than generate a CSV file and use the exchange admin tool to import it]? Thanks Wayne ...

User Authentication
Hello All I want to authenticate a windows user i cant use LogonUser because the client user may not have SE_TCB_NAME privilage i am using SSPI but in case of error i does not provide exact error message: For example if the user is not allowed to log on the domain from the this computer. SSPI gives an internal SSPI error rather than informing that the user is not allowed to login from this computer. Is there any other way to authenticate domain and Local users. Thanks in Advance! Faisal Mansoor ...

can,t find my e-mail address
please help reply thank you "dc columbus robbins" <robbinsnest@localnet.com> wrote in message news:eJFE6ktBIHA.324@TK2MSFTNGP04.phx.gbl... > please help reply thank you This newsgroup is for questions and answers about Microsoft Access database software. You need to find a newsgroup for the software you are using. And, just for your information, you have to be a great deal more specific about what you are doing, and what is happening, if you expect anyone to be able to give you a helpful answer. "Can't find my e-mail address" doesn't tell ...

OWA Users/Expired passwords
I have several users who will only be logging in to Outlook Web Access (Exchange 2003), and once they're logged in to OWA they can change their passwords, but if they for some reason let their passwords expire, OWA doesn't allow them the opportunity to change their passwords; this is the case whether we use a dialog login box or forms-based authentication. Is there any way we can set OWA so that it automatically takes a user to the IIS password change screen if someone tries to log in with an expired password? this should solve your problem http://www.petri.co.il/enable_pass...

Opening other user's folder
We are on exchage 5.5 with outlook 2000 for the clients. When going to File/Open other user's folder, in the pulldown list of choices, we only see Calendar, Contacts, Inbox, Journal, Notes, & Tasks. It doesn't show Deleted Items or Sent Items. How can I get those two other folders to show up in the list? You would need to actually add User B's mailbox to User A's profile to make those extra folders available -- there's no way to add them to the Open Other User's Folder list. First, give User A Reviewer permission at the root of User B's mailbox. Then, make ...

What is the maximum number of users that can share Excel File?
According to the Excel Help file, all users on your network, unless you restrict the number. "pfine" wrote: > ...

find data in multiple open workbooks
Im looking to find data in multiple workbooks that are all opened at once. Is there a way of doing this? ...

Opening another user's appointment copies appt into my Calendar
I frequently open other users' appointments when viewing their calendars. However, upon opening the item, a copy of the appointment then appears in my personal calendar. Does anyone know why this is happening and how to make it stop? Thanks. ...

Moving my files to a new computer
So I've copied my old .pst file to my new computer, used Tools>options>mail setup>data files to introduce outlook to it, and reset it to to default and removed the old entry so there is just the one entry in the list. Both my new and old outlooks are 2003. So far so good and I can see my mail folders and contacts in the left hand pane, *but* tools>address book is not showing any of my contact addresses, nor will check names show them. Anyone know whay or can point me at an article that tells me what to do? Also, I have several email accounts is there an easy way of movi...

BCP Computed Column
Hi. I have a table with a computed column. When I try to import data into table through BCP it generates error due to computed column. So how to handle a computed column while importing data into table through bcp from a text file. Regards, Muhammad Bilal You need to use a format file that tells BCP to skip that column. See BOL for info on bcp format files. Tom "Muhammad Bilal" <MuhammadBilal@discussions.microsoft.com> wrote in message news:5AD65421-C599-4773-B56F-24841FE05D5A@microsoft.com... > Hi. > > I have a table with a computed column...

User able to see records that he is not supposed to
Hi, I have a user having a role that has permission to read only records that are created by him. He is able to see records that are assigned to a team X. He is not a member of team X. I have no clue how he is able to see it. I have checked every setting very carefully.Please help. IS IT a Microsoft CRM BUG??? Cheers, kunal Hi, Kunal, Can you please provide the specific settings of the security role(s) assigned to the user? Thanks, Leslie -- This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send e-mail directly to this alias. This ...

CRM 4 Advance Finds with Windows 7
I have for some time been using CRM4 with windows 7 (RC and RTM) and have found one problem. Just wondering if anyone else has seen this and found a resolution yet. When in an advance find it will hang when selecting a pick list. For example. Open advanced find, Select Activities and use saved view [new] In the details select ActivityStatus as the Field, select equals and then click the three dots to chose the values. Select any values then click OK. At this point the page still says 'enter value' and alot of the page can not be clicked on. This will always happen on a new adv...

Changing the names of fields in tables after creating other object
I just leaned about the naming conventions after I have created my tables, reports and several queries. Can I change the name of fields in my tables (to remove the spaces and give them unique names ie not just last name but childlastname) without destroying the work I have done in queries, reports, and forms. Mary -- Positive Direction for Youth & Families, Inc. (www.pdfyinc.com) Possibly. If you are using a newer version of Access, say 2003 or 2007 AND you have Name Autocorrect, and all it's options, enabled, it MIGHT work. I found it somewhat buggy. Before you...

Deny External Email for specified users
I would like to know how to deny certain internal users from sending or receiving internet based emails. Is there some type of security for the SMTP queues. http://support.microsoft.com/view/tn.asp?kb=316281 -- Sincerely, D�j� Ak�m�l�f�, MCSE MCSA MCP+I Microsoft MVP - Directory Services www.readymaids.com - COMPLETE SPAM Protection www.akomolafe.com Do you now realize that Today is the Tomorrow you were worried about Yesterday? -anon "John Veliss" <anonymous@discussions.microsoft.com> wrote in message news:1c7701c49c5e$0290cf00$a401280a@phx.gbl... > I would like to ...

CRM should allow relationships between entities and system users.
I would like the ability to manage relationships between System Users and CRM Entities. We have folks dedicated in varying capacities to any given Account. e.g. - Bob is the Outside Sales contact - Becky is the Service Representitive - John is the Educational Coordinator Each of these may individuals consider an account "theirs" from their own perspective and therefore feel that the Account should show up in the "My Accounts" view. The Single-User Ownership model does not need to be revamped - but perhaps it could be made more flexible through user preferences. A. ...

Use of user's group with W2000
Two things: 1-If no MVP can answer a question, someone should tell the questioner so he/she can move on. Frustration is high enough without being ignored. 2-It is grossly unfair that I can't post questions because I have W2000 and am limited to Explorer6. I can't even get to this page. Microsoft should not squeeze us out of the loop. (I borrowed a friend's computer with XP and explorer7 to write this and to post my unaswered question.) ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for th...

Reactivating Office on a new computer.
I had a downloaded copy of Office 2007 on a laptop which has been destroyed beyond repair. I have now bought a new laptop. How do I re-download my copy of Office, please? -- Steve Contact the vendor from where you purchased it. "stemac" <stemac@discussions.microsoft.com> wrote in message news:795E14D0-A5F1-4CA4-B2B4-A102986CBADD@microsoft.com... :I had a downloaded copy of Office 2007 on a laptop which has been destroyed : beyond repair. I have now bought a new laptop. How do I re-download my copy : of Office, please? : -- : Steve The vendor was...

finding common numbers in large lists
Hello, I have two large lists of numbers (on two seperate worksheets). By large, I mean that one list is 1000+ numbers, and the second list is 3000+ numbers (each number is in its own cell). The numbers are of the form: xxxx.xxx (that is, they are precise up to three places after the decimal) 1) Is there some quick way that I can find the numbers that are common to both lists? 2) Is there a way I can find the numbers in common to both lists using only the whole number portion (diregarding what comes after the decimal of each number)? Thanks! Hi see: http://www.cpearson.com/excel/duplic...

.xls changes sizes from one computer to another
An excel worksheet that we use prints out nicely on one computer; however, when another user accesses it off of the network and does a print preview, the columns of the worksheet squash together in the middle of the worksheet into and only by reducing the view by 99% is the second user able to print correctly. I don't know the circumstances regarding this but I am told this is the way it has always been. Any input would be greatly appreciated. ...

name appearing in the outgoing mail
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop I would like to change the way the name in each of my accounts shows up in sent emails. I have changed the account settings but the old name still shows up. Any suggestions? <br> Thanks. On 2010-05-04 16:45:26 -0400, Bila@officeformac.com said: > I would like to change the way the name in each of my accounts shows up > in sent emails. I have changed the account settings but the old name > still shows up. Any suggestions? Well if you have indeed changed the name prop...

How can I compare the column names from 2 tables and output them?
I have a requirement to place an alert if the field does not exist in my table, tblStaging. Can any one guide me to reframe this query with error handling messages? I know it is not good practice to use select * but I need to do this as my columns\field names change each time. INSERT INTO tblStaging SELECT * FROM tbl_XL,tblDetails; Thank you -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1 Access is a relational database. If your "table design" has the fields in your table(s) changing frequently,...

Advanced Find should let me search records between two dates
When searching the system for records, many times I need to search for records that came in between two dates. For instance, I would like to be able to pull all records input in CRM between March 1 and March 15. In 3.0 you can only query specific dates like "Last X days," "Last X Months," "On," "On or After," etc., but you cannot search the date fields between two dates. The functionality was available in 1.2 but is not available in 3.0. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the...