VBA Skript not working after DB shutdown (1 Viewer)

MiCoMaSe

New member
Local time
Today, 20:10
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:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:10
Joined
Oct 29, 2018
Messages
21,454
Hi. What happens if you step through the code during debugging? What did the error message say?
 

MiCoMaSe

New member
Local time
Today, 20:10
Joined
Jun 4, 2019
Messages
6
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"
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:10
Joined
Sep 21, 2011
Messages
14,236
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:10
Joined
Oct 29, 2018
Messages
21,454
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?
 

MiCoMaSe

New member
Local time
Today, 20:10
Joined
Jun 4, 2019
Messages
6
Thank you Gasman that solved the Problem.

@theDBguy POS is a Number.
 

MiCoMaSe

New member
Local time
Today, 20:10
Joined
Jun 4, 2019
Messages
6
Thanks theDBguy,
Luck is what I need but I need more knowledge than Luck:eek:
 

Users who are viewing this thread

Top Bottom