Results 1 to 11 of 11

Thread: [RESOLVED] Works manually, not in auto mode

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Resolved [RESOLVED] Works manually, not in auto mode

    I have an app that I'm trying to fire off automatically every morning. I've created the app and I can run the executable and it works if I manually run the program... there are no errors and it appears to do its job.

    However, when I set it up to run automatically (using AT from the command line and passing the app a parameter to tell it to shut itself down after running, I get errors (Error 6 - Overflow). My program continues on, but I get about 3 of these in my error log file.

    The program is simple... it talks to 2 databases on 5 sucsessive calls and emails out some reports if any are overdue.

    I don't know how to trap the error because it doesn't do it when I run it through the IDE or even manually running the EXE.

    If anyone has any idea why this might be happening, I'd love to hear it.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Works manually, not in auto mode

    I don't know how you are exiting your program, but you probably aren't closing all objects that you opened. You have to unload them and set them to nothing. You also have to close all forms.

    Here is a routine that I call on a button click to shut down everything.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.  Dim frm As Form
    5.   Dim obj As Object
    6.   For Each frm In Forms
    7.      If frm.Name <> Me.Name Then ' Unload this form LAST
    8.        For Each obj In frm
    9.          On Error Resume Next
    10.            Unload obj
    11.            Set obj = Nothing
    12.        Next
    13.        Unload frm
    14.        Set frm = Nothing
    15.      End If
    16.     Next
    17.     On Error Resume Next
    18.       For Each obj In frm
    19.         Unload obj
    20.         Set obj = Nothing
    21.       Next
    22.       Set frm = Nothing
    23.       Unload Me
    24. End Sub

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Works manually, not in auto mode

    It's not really a question of exiting the program. It exits the program fine. It's a question of why it doesn't process the data without errors when run automatically when it works fine when in manual.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Works manually, not in auto mode

    When you run it manually, do you run it from the command line with the same passed parameter?

  5. #5

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Works manually, not in auto mode

    Well, I've run it both from the IDE and by just double-clicking the EXE.

    However, after doing a bunch of testing, I've narrowed it down to the fact that it never connects to the database. This just doesn't make sense. It connects fine when running it manually.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Works manually, not in auto mode

    Since we are all gropping around in the dark, could it have anything to do with the time of day?

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Works manually, not in auto mode

    Did You Try Running From The Command Line With Same Parameters You Pass When You Run Using The AT Command
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Works manually, not in auto mode

    Or maybe a user/password problem?

    Maybe you could use a batch file with the START command?

  9. #9

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Works manually, not in auto mode

    It's not the time of day, because as I'm testing, I keep setting it up using the AT command and passing the parameter. So I've ran it about 30 times in the past 2 hours. I've also run it from the IDE passing the parameter through the properties of the project.

    No matter what I do, running from the IDE or the executable without the auto parameter works. Running from the IDE with the auto parameter works. Yet, running from the executable through the AT command with the parameter fails.

    I'm running out of places to look real damn fast.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  10. #10

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Works manually, not in auto mode

    AAAnnnd... I think I'm an idiot. This is also weird, however... if I open the app, it gets the server names out of the registry. So I open it manually and change them to what they need to be and close the app (saving those settings). However, when it runs through the AT command, it doesn't grab those values. It takes the default, which was the server I used to be on (never updated the code). So obviously it isn't going to connect. Now I'm wondering why it doesn't grab the same values.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  11. #11

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Works manually, not in auto mode

    *sigh*.... sorry for the rat race all. I've moved the settings into an INI file and everything is working now.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width