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

Access VBA and the Machine

Status
Not open for further replies.

Phudsen

Technical User
Mar 7, 2003
136
A2
Hi,

Is it possible to read the machine number using Access VBA? This is to be used as security for the program.

Or, how can I make sure that the program "Access Program" I give to Mr. X can not be used by Mr. M?

Thank you
Paulin
 
You can write code to check the person logged into the machine. I don't know how but I've found some code on here before. Good luck.

-Laughter works miracles.
 
Here is how to get the C: drive serial number:
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive("C:")
s = Hex(d.SerialNumber)
MsgBox "SN of C: is " & Left(s, 4) & "-" & Right(s, 4)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi

You can return the Computer name on the network with the following code (courtesy of Dev Ashish)

Option Compare Database
Option Explicit

Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSMachineName() As String
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
If the issue is to get the netbios computer name (not the same as machine number) and provided you're not with a win9x kernel (ie you're on NT,2000,XP or 2003) then simply try this:
MsgBox Environ("USERNAME") & " on " & Environ("COMPUTERNAME")

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

Thank you for your replies.

PHV, when I tried your code I got this number:
44B9-10E5
Is this the Hard Disk number?
Is this number Unique?

When I did ipconfig /all I got the physical addresses:
Ethernet Physical Address:
00-07-E9-BD-E2-12 and

PPP Adapter:
00-53-45-00-00-00

Which one is the MAC address?

Can I use the hard disk number as means for security? I save the number in a veriable then match it when the form loads, if it does not match then the owner of the application gave a copy to someone esle.

Thanks a lot




 
1) It is the partition serial number assigned during the formatting. If you reformat your partition, this number change. AFAIK nobody can force this number to a predefined one.
2) The MAC address of the NIC is it's Ethernet Physical Address, but I know some NICs accept aliases, so someone may cheat.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PHV,

So, in your opinion what is the best way to protect the program I give to a customer. I don't want him to give copies to others.

The program is Fully in Access and VBA.

If you make a system to someone in Access, how do you protect it?

Thanks for your input.

Paulin
 
Do the test with the C: drive serial-number and give your program as an MDE.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PHV,

Good idea and when he changes his hard dis he can call me.

Is the hard disk number unique?

Thanks
 
It should be

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top