DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 764 Views - Last Post: 23 June 2013 - 01:08 PM Rate Topic: -----

#1 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 22 June 2013 - 02:57 PM

I'm approaching the finish line on a 9 month long project and 2 mysterious things happened today.

1. The ON ERROR GOTO xxx stopped working!

2. The sizes of frames and in the main form changed from numbers like 5060 to some thing like 64903.63 (a multiple of more than 10 with decimals). When I copy the frame into a form in another program the sizes become normal again. They no longer appear properly with these new number which I have no clue what caused them.

3. Help will be rewarded with mucho thanks a worthless copy of the program that was destined to sell in the $5000 range

Admin Edit: <Removed email per site policies>

This post has been edited by macosxnerd101: 22 June 2013 - 03:02 PM
Reason for edit:: Removed email


Is This A Good Question/Topic? 0
  • +

Replies To: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10180
  • View blog
  • Posts: 37,586
  • Joined: 27-December 08

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 22 June 2013 - 03:02 PM

Please post a minimum runnable sample of code that illustrates your problem. Remember to use code tags: :code:.
Was This Post Helpful? 0
  • +
  • -

#3 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 22 June 2013 - 03:06 PM

This is the code that always worked before (used to test for a files existance)!

On Error GoTo 525

Open folder$ + "HeadHunterA.sys" For Input As 1
Close

Now the program stops and I get a "FILE NOT FOUND ERROR"
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10180
  • View blog
  • Posts: 37,586
  • Joined: 27-December 08

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 22 June 2013 - 03:09 PM

Well, clearly the File isn't in the path you are directing your program to search at.

Also, you really haven't provided enough code to cover your problems. Please put something together so that our members can run the code if necessary and help you ascertain the problem. You need to use code tags as well: :code:.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2877
  • View blog
  • Posts: 9,548
  • Joined: 12-December 12

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 22 June 2013 - 03:18 PM

Although the code compiles, labels should start with a letter IMO and the file number should be preceded by a hash-sign, and this number used explicitly with Close:

On Error GoTo someLabel '525

Open folder$ + "HeadHunterA.sys" For Input As #1
Close #1

I haven't double-checked whether the hash-sign is a requirement, but I would anticipate odd behaviour without it. Correction: the hash-sign is not required, although I recommend its use.

If 525 did not exist as a label in this procedure then a compile error would result, so this shouldn't be the problem.

To account for the current behaviour, though, I could only guess that you have On Error Goto 0 somewhere between the first two lines. Added: or your error-handling code (re)raises the error.

But I agree with macosxnerd101 that you should provide more code.

This post has been edited by andrewsw: 22 June 2013 - 03:27 PM

Was This Post Helpful? 0
  • +
  • -

#6 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 06:53 AM

The on error goto sample I provide has worked for the past 9 months and for the 15 years I have been programming with VB6...

   on error goto 525
  
          open "FILENAME.DAT" for input as 1
          close
          goto 625

525       'file does not exist
          resume 625

625       close 1  


'file exists
Was This Post Helpful? 0
  • +
  • -

#7 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 07:19 AM

View Posthamptondude, on 23 June 2013 - 03:53 PM, said:

The on error goto sample I provide has worked for the past 9 months and for the 15 years I have been programming with VB6...

   on error goto 525
  
          open "FILENAME.DAT" for input as 1
          close       '<---------------------------[Where is the file number?
          goto 625

525       'file does not exist
          resume 625

625       close 1  


'file exists

first: what is FILENAME.DAT? where is the rest of the file path? on what drive and folder it sit?
second: if you just want to know if the file exist or not then why dont you use the Dir$(filepath)
example code:
If Dir$(filepath)="" then 'filepath must include drive letter and folder (if file is in a folder), should the file is in the same folder as the exe of the program then using App.Path is much more flexiable as it will always set the path regardless to where you install the program, much better than hardwritten paths
MsgBox "Error file not found"
Else
Msgbox "File found"
End If



third: after the GoTo the label should start with a letter.
forth: after you open the file you close it but you didnt give the file number, this probably couse problems
Was This Post Helpful? 1
  • +
  • -

#8 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2877
  • View blog
  • Posts: 9,548
  • Joined: 12-December 12

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 07:34 AM

You have told it that, when there is an error, jump to line 525;
line 525 resumes (reinstating error handling) from line 625;
line 625 attempts to close a file, which was not found or opened, generatiing an error - which will be displayed.

I suggest you re-write the code. Even 15 years ago this code would have been considered very poor, as well as being incorrect. Use Neku 's code.

This post has been edited by andrewsw: 23 June 2013 - 07:43 AM

Was This Post Helpful? 0
  • +
  • -

#9 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 08:14 AM

I appreciate everyones input - be assured I am not making coding errors - I have used this ON ERROR GOTO routine 1000's of times before. This is the first time it just stopped working for no apparent reason. (Also please note that if the CLOSE statement is omitted after the error even if the file does not exist - FILE #1 - remains in an OPEN state. I also use the ON ERROR for date testing which is also not working. I apologize for not really knowing programming etiquette but I learned to program reading Visual Basic programming for dummies and believe it or not some of my programs sell in the $20,000 range. The real concern is the damaged form in which the frame sizes changed to drastic numbers ex.. width 5000 changing to something like 67234.78 etc. When the frame is copied into another form - the correct sizes return (Which is what saved 9 months of work)
Was This Post Helpful? 0
  • +
  • -

#10 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 08:24 AM

Has the scalemode on the form containing the frame changed? I assume, based on the 5000, it should be twips on the form.

In regards to the error handling, maybe I missed it in your post, but are referring to a compiled version of your program or when you run in the IDE??

If it's in the IDE, check the Error Handling setting....Tools-Options-General tab and ensure Break on all errors isn't set, as it's my understanding that this will in effect disable all your "On Error" statements.

This post has been edited by maj3091: 23 June 2013 - 08:52 AM

Was This Post Helpful? 0
  • +
  • -

#11 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 08:52 AM

PLEASE ADVISE: HOW DO I CHANGE THE 'SCALEMODE' ON A FORM??????
Was This Post Helpful? 0
  • +
  • -

#12 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 08:54 AM

Please drop the caps lock, it comes across as shouting....

Click on the form and you will find it in the properties window.

If you don't already have it open, you can find it under the View Menu, or you can press F4 to display it.

I'd be interested to hear about the other part of my question regarding running in the IDE or compiled....

This post has been edited by maj3091: 23 June 2013 - 08:58 AM

Was This Post Helpful? 0
  • +
  • -

#13 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 08:59 AM

To install the HAMPTON CORP. HeadHunter software system...


=================================================================================
1. Click the file... "Extract_HeadHunter_files.exe" to extract the software

2. Run... "SETUP.exe" (click it)

when that completes installation...

3. Run... "run_this_after_running_SETUP.exe" (click it)
=================================================================================


That's it - when finished installing - you can delete all the installation files...
This software is fully functional.
Go to your desktop and click on the HeadHunter icon and enjoy!

(Watch the setup Video!)

Minor Note: MS word is required to use the FORM TEMPLATES.
Your .DOC files need to open with WORD when they are "clicked"
If they do not open automatically - right-click the file and select OPEN WITH ---> MS WORD as default.
Was This Post Helpful? 0
  • +
  • -

#14 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 09:01 AM

View Posthamptondude, on 23 June 2013 - 03:59 PM, said:

To install the HAMPTON CORP. HeadHunter software system...


=================================================================================
1. Click the file... "Extract_HeadHunter_files.exe" to extract the software

2. Run... "SETUP.exe" (click it)

when that completes installation...

3. Run... "run_this_after_running_SETUP.exe" (click it)
=================================================================================


That's it - when finished installing - you can delete all the installation files...
This software is fully functional.
Go to your desktop and click on the HeadHunter icon and enjoy!

(Watch the setup Video!)

Minor Note: MS word is required to use the FORM TEMPLATES.
Your .DOC files need to open with WORD when they are "clicked"
If they do not open automatically - right-click the file and select OPEN WITH ---> MS WORD as default.


you've completely lost me??????
Was This Post Helpful? 0
  • +
  • -

#15 hamptondude  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-November 05

Re: DISASTER after 6 months of work? ON ERROR NO LONGER WORKS

Posted 23 June 2013 - 09:13 AM

As they say in my fair lady MAJ3091 - YOU DID IT!


''''Tools-Options-General tab and ensure Break on all errors''''

How this got changed is a mystery BUT you did it thanks a million times for solving problem 1. I owe you one

If anybody want to see one of the programs written by a 75 year old after reading VB6 programming for dummies that sells in the $5000 to $20,000 range click the download link....

https://dl.dropboxus...unter_files.exe
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2