Invalid use of Null (Error 94)

javajom

Javajon
Local time
Today, 22:47
Joined
Mar 5, 2008
Messages
37
Hi,
I'm new to the vb code and having a problem with the form/vb, I've written a function that will check a password entered into the form against an array. It's a sinple form that has a password enter box, which is formatted to password in the properties a enter button and a cancel button. The cancel button works fine as once pressed exits the application. The problem is that if you press enter with no input in the password dialog box I get: Invalid use of Null (Error 94).

PHP:
Dim pWord As String
pWord = Forms!secure111.ques.Value
If IsNull(Forms!secure111.ques.Value) Then
Application.Quit
End If
DoCmd.Close acForm, "secure111", acSaveNo

So the code gives the value of Forms!secure111.ques.Value to pWord and then compares it to the array contents, which works fine I've tried to cover the null value by

If IsNull(Forms!secure111.ques.Value) Then
Application.Quit
End If


But the line: pWord = Forms!secure111.ques.Value always shows the error Invalid use of Null (Error 94) when no data in dialog box when enter is pressed. Any ideas?????
 
A string (pWord) cannot contain a null value
If you more your check to BEFORE the line it crashes on (seems pretty self evident) you will resolve your problem
 
Sorry can you explain, I'm new to this???
 
Uhm....

sorry??

YOU created a check for the null value OR so you say....
Now it is crashing on the line before said check " Null not allowed "... So move your check up one line...
A matter of cut and paste??? What do you mean explain?
 

Users who are viewing this thread

Back
Top Bottom