VBA Skript not working after DB shutdown

MiCoMaSe

New member
Local time
Today, 01:31
Joined
Jun 4, 2019
Messages
6
Hello Folks,
I am going nuts..
After I enterd the Code below, everything worked OK.:D
But after I restarted my DB I get the error message from Access (Dont like the System error Messages) but not like in the Code a VB Message.:banghead:

Code:
Private Sub btnpos_Click()
   
        If searchpos.Value = "" Then
        MsgBox ("Please enter a Pos#")
        
    Else
         Me.Recordset.FindFirst "POS = " & searchpos.Value
         Exit Sub
    End If

End Sub

Anybody an Idear whats wrong???
Or am I just to stupid....:confused::confused::confused:
 
Hi. What happens if you step through the code during debugging? What did the error message say?
 
It gives me the message that "searchpos" is NULL.
That is right, then the Skript should give the message "Please enter a Pos#"

But at the Moment I dont get the VB Message, i Get the System message
"Runtime error 94 Invalid use of Zero"
 
It gives me the message that "searchpos" is NULL.
That is right, then the Skript should give the message "Please enter a Pos#"

But at the Moment I dont get the VB Message, i Get the System message
"Runtime error 94 Invalid use of Zero"

PMFJI

No, it should not, as you are testing for a ZLS. Null and a ZLS are different.?
Try
Code:
If nz(searchpos.Value,"") = "" Then

HTH
 
It gives me the message that "searchpos" is NULL.
That is right, then the Skript should give the message "Please enter a Pos#"

But at the Moment I dont get the VB Message, i Get the System message
"Runtime error 94 Invalid use of Zero"
Hi. Is POS a number or text value/data type?
 
Thank you Gasman that solved the Problem.

@theDBguy POS is a Number.
 
Thanks theDBguy,
Luck is what I need but I need more knowledge than Luck:eek:
 

Users who are viewing this thread

Back
Top Bottom