Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-14-2019, 06:44 AM   #1
MiCoMaSe
Newly Registered User
 
Join Date: Jun 2019
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
MiCoMaSe is on a distinguished road
VBA Skript not working after DB shutdown

Hello Folks,
I am going nuts..
After I enterd the Code below, everything worked OK.
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.

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....

MiCoMaSe is offline   Reply With Quote
Old 06-14-2019, 07:26 AM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,683
Thanks: 56
Thanked 1,257 Times in 1,238 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: VBA Skript not working after DB shutdown

Hi. What happens if you step through the code during debugging? What did the error message say?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 06-14-2019, 07:45 AM   #3
MiCoMaSe
Newly Registered User
 
Join Date: Jun 2019
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
MiCoMaSe is on a distinguished road
Re: VBA Skript not working after DB shutdown

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"

MiCoMaSe is offline   Reply With Quote
Old 06-14-2019, 07:53 AM   #4
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,323
Thanks: 431
Thanked 787 Times in 764 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: VBA Skript not working after DB shutdown

Quote:
Originally Posted by MiCoMaSe View Post
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
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
The Following User Says Thank You to Gasman For This Useful Post:
MiCoMaSe (06-14-2019)
Old 06-14-2019, 07:55 AM   #5
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,683
Thanks: 56
Thanked 1,257 Times in 1,238 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: VBA Skript not working after DB shutdown

Quote:
Originally Posted by MiCoMaSe View Post
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?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 06-14-2019, 08:11 AM   #6
MiCoMaSe
Newly Registered User
 
Join Date: Jun 2019
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
MiCoMaSe is on a distinguished road
Re: VBA Skript not working after DB shutdown

Thank you Gasman that solved the Problem.

@theDBguy POS is a Number.
MiCoMaSe is offline   Reply With Quote
Old 06-14-2019, 08:13 AM   #7
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,683
Thanks: 56
Thanked 1,257 Times in 1,238 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: VBA Skript not working after DB shutdown

Quote:
Originally Posted by MiCoMaSe View Post
Thank you Gasman that solved the Problem.

@theDBguy POS is a Number.
Hi. Glad to hear you got it sorted out. Good luck with your project.

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 06-14-2019, 08:17 AM   #8
MiCoMaSe
Newly Registered User
 
Join Date: Jun 2019
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
MiCoMaSe is on a distinguished road
Re: VBA Skript not working after DB shutdown

Thanks theDBguy,
Luck is what I need but I need more knowledge than Luck

MiCoMaSe is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Shutdown paulscherm Modules & VBA 3 01-17-2013 08:07 AM
Can't log off or shutdown XP the_net_2.0 Windows 3 02-03-2011 09:34 PM
Forced shutdown/inactivity shutdown OpnSeason Sample Databases 2 08-07-2006 02:04 AM
Shutdown DB at specified time Ade F General 4 04-11-2004 04:10 AM
Error & Shutdown DJ100 General 1 09-02-2002 03:46 AM




All times are GMT -8. The time now is 01:25 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World