Problem with HD Serial

history

Egyptian Pharaoh
Local time
Today, 07:58
Joined
Jan 26, 2008
Messages
190
Hello Brothers,

I have a form that requires serial no to enter the database
this serial no is depending on the HD serial no after calculation
but no way to enter.

The code I'm using On Click event on the form:
Code:
 If (Me.HardiskSerialNo.Value - 479277050#) = Me.txtSerialNo1.Value _
 And (Me.HardiskSerialNo.Value - 479277200#) = Me.txtSerialNo2.Value _
 And (Me.HardiskSerialNo.Value - 479277180#) = Me.txtSerialNo3.Value _
 And (Me.HardiskSerialNo.Value - 479277150#) = Me.txtSerialNo4.Value Then
DoCmd.Close
DoCmd.OpenForm "frmUserLogon"

Else
MsgBox "Sorry the Registration Code is not valid." & vbCrLf & "The program will be terminated." & vbCrLf & "Try to contact the Programmer.", vbOKOnly + vbMsgBoxLeft + vbCritical, "Failed"
DoCmd.Quit
End If
The Code in the module:
Code:
Sub ShowDriveInfo()

Set fs = CreateObject("Scripting.FileSystemObject")
Set H = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName("D:")))
'Don't forget to put the drive you want to assign the serial no to
      
   
Forms!KHEPRE!HardiskSerialNo.Value = H.SerialNumber
If (Forms!KHEPRE!HardiskSerialNo.Value - 479277050#) = Forms!KHEPRE!txtSerialNo1.Value _
And (Forms!KHEPRE!HardiskSerialNo.Value - 479277200#) = Forms!KHEPRE!txtSerialNo2.Value _
And (Forms!KHEPRE!HardiskSerialNo.Value - 479277180#) = Forms!KHEPRE!txtSerialNo3.Value _
And (Forms!KHEPRE!HardiskSerialNo.Value - 479277150#) = Forms!KHEPRE!txtSerialNo4.Value Then
DoCmd.Close
DoCmd.OpenForm "frmUserLogon"

Else
MsgBox " Please prove that you're authorized to use the program by registering your version "
End If
End Sub

waiting your help
 
Hello brothers,

I need your help if someone can

Thanks in advance
 
What's your problem exactly? You've posted some part code. Where are you calling the module?
 
The problem is the Vba Code doesn't work with me, I think the Vba Code is right but sure there is something wrong.
I'm filling the textboxes by the values that should be entered.
It supposed after I click enter, let me log on , but it gives me message that "the registration Code is not valid"

waiting you brothers
 
Add the following line after the line Forms!KHEPRE!HardiskSerialNo.Value = H.SerialNumber:

Code:
debug.print Forms!KHEPRE!HardiskSerialNo.Value, Me.txtSerialNo1.Value,Me.txtSerialNo2.Value,Me.txtSerialNo3.Value,Me.txtSerialNo4.Value

This will display the forms values in the Immediate window of the VBA editor.

Check the values to see they are what you expect.

Chris
 
I made as you said

when the form load gives error message :
"Compile error : Invalid use of Me keyword"
and Highlight on the line that we've added and refers to :
debug.print Forms!KHEPRE!HardiskSerialNo.Value, Me.txtSerialNo1.Value,Me.txtSerialNo2.Value,Me.txtSerialNo3.Value,Me.txtSerialNo4.Value
 
Sorry, try:

Code:
debug.print Forms!KHEPRE!HardiskSerialNo.Value, Forms!KHEPRE!txtSerialNo1.Value,Forms!KHEPRE!txtSerialNo2.Value,Forms!KHEPRE!txtSerialNo3.Value,Forms!KHEPRE!txtSerialNo4.Value
 
Yes, now no errors
and the values in the Immediate window of the VBA editor that I expect
but the problem still exist,,, I can't logon
 
Next try:

Code:
DEBUG.PRINT Forms!KHEPRE!HardiskSerialNo.Value - 479277050#

Does that give the expected value?

Also, I assume you are entering 4 values into the form and that all 4 values have to match?

Chris
 
Made as you said but the same result
gives me message that "the registration Code is not valid"
 
But what was the result of the last debug?
DEBUG.PRINT Forms!KHEPRE!HardiskSerialNo.Value - 479277050#

What value did it print in the Immediate window? Does the value match the value the user enters in the form?

Also, are you expecting all four entries to match with the corresponding calculations?
 
it gives value match with the user's value according to the calculation

I'm expecting all four entries to match with the corresponding calculations
because all the four entries must be right to let the user log on
 
What about this... do the pairs match one each line in the Intermediate window?

Code:
DEBUG.PRINT (Forms!KHEPRE!HardiskSerialNo.Value - 479277050#), Forms!KHEPRE!txtSerialNo1.Value
DEBUG.PRINT (Forms!KHEPRE!HardiskSerialNo.Value - 479277200#), Forms!KHEPRE!txtSerialNo2.Value
DEBUG.PRINT (Forms!KHEPRE!HardiskSerialNo.Value - 479277180#), Forms!KHEPRE!txtSerialNo3.Value
DEBUG.PRINT (Forms!KHEPRE!HardiskSerialNo.Value - 479277150#), Forms!KHEPRE!txtSerialNo4.Value

By the way, when I do the calc I get a minus number so I assume these numbers are based on your hard drive values.
 

Users who are viewing this thread

Back
Top Bottom