VB compiled exe causing error on win 98, but not on win2k or winxp

Posted on 2003-11-10
Last Modified: 2010-05-01
Hi experts,

I'm developing my apps with VB 6.0 sp5 installed on win xp. I have create an exe file that runs fine on both winxp and win2k. However, when I try to execute that file on win 98 machine, there are errors. This error may vary between "EOF or BOF expected.." or "Error 13, Type mismatch". I've tried over and over again to do the same thing I was doing on the win98 machine to the application installed on win2k and winxp, but no error ever occured.

My applicaton have a combo box that lets user choose something and then query the database (which is MS SQL Server 2000 in this case) according to the selection on the combo box. The error occured when user was browsing through the combo box, and whether they select something (combo1_click event call) or just decided to click on the other part of the form (automatically closing the dropdown menu of the combo box) those error would occur. The EOF/BOF error only occured on some of the combo box when user select a value.

Why is this happening ? I have installed the following components on the win 98 machine :

vb 6.0 with vs 6.0 service pack run time files
microsoft data access components 2.7

Anything else I should install on the win 98 machine ? because this only happen on win 98 machine and not on win2k or winxp ?

Help Please.

Question by:hama-ayu-ism
LVL 76

Expert Comment

ID: 9720511
You'll have to debug the program in Win98 somehow.
You have two choices.
1. Have VB6 installed on a Win98 system.
2. Create a trace/error log to find out where and why your exe is malfunctioning.

LVL 76

Expert Comment

ID: 9720520
As a general rule, you should develop in the earliest environment that you intend to support.
LVL 76

Expert Comment

ID: 9720586
This could be your Logging routine. It creates a new file for each day.

PubLic Const gstrLogFilePrefix = "abc"

Public Sub WriteLog(LogText As String)
    Dim f As Integer
    Dim TextLine As String
    Dim LogFile as String

    TextLine$ = Time & ": " & LogText
    Debug.Print TextLine$ 'For use in design mode
    LogFile$ = App.Path & "\" & gLogFilePreFix$ & Format$(Now, "yy") & Right$("00" & Format$(Now, "y"), 3) & ".log"
    f = FreeFile
    Open LogFile$ For Append As f
        Print #f, TextLine$
    Close f
End Sub
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 9720626
Hi GrahamSkan,

Where should I put this sub procedure you're writing above ? And when should I execute them ?

I don't think installing VB6 on the win 98 is a choice.. I don't have any PC left... and I'm not allowed to messed up with machines that are running all other application ok...

Do let me know where to put the sub routine you wrote though.. that might be the best way for the moment.

LVL 76

Expert Comment

ID: 9720648
That's only an example of the central logging procedure. Put it in a module.
You will also need something like the following in parts of your program that you suspect might be causing the problem. (Sorry, it might be a lot of work)

Function MyProcedure(strVariable1 As String, iVariable2 As Integer) As Boolean
WriteLog "MyProcedure: strVariable1 = " & strVariable1 & ", " & "iVariable2" = iVariable2
On Error GoTo MyProcedureError
'some code
Select Case iVariable
    Case 1
        If strVariable = "Hello World" Then
            MyProcedure = True
        End If
End Select
WriteLog "MyProcedure: " & MyProcedure
    Exit Function
    WriteLog "MyProcedureError: " & Err.Description
    Select Case Err.Number
        Case 12345, 67890 '(say)
            Resume Next
        Case Else
            Resume MyProcedurExit
    End Select
End Function


Author Comment

ID: 9720724
Hi GrahamSkan,

This might sound stupid, but I don't understand at all on what I have to do ? could you give me step by step on what I have to do ?

Do I get this right...

I have to create a module, and put Public Sub WriteLog on that module. After that, I need to create the MyProcedure function and put it on the part of coding that I think is causing the error ? Is that true ?


Accepted Solution

MaxPol earned 110 total points
ID: 9721674
I think, for testing purpose, you should start adding msgbox just after each line of code executed after a combo selection or in any combo event.


Orig Code is

Sub Combo1_OnClick ()
msgbox "Start"
do something
msgbox "Something done"
do smething else
msgbox "Something else done"
Do another thing
msgbox "Another thing done"
msgbox "End sub onCLick"
End Sub

That will show you after which instruction you get the error and better analyze after.



Expert Comment

ID: 9721681
Do you have API calls in your VB program? Some API calls that are supported by 2K and XP are not present in 98. Also if your app uses some other components or references that are not present on the 98 machine you will receive the error.

You could develop a very small VB app, place a combobox and a textbox and a button on a form to see if its the combobox or DB query. Do something (like in your app) with the combo and see do you get the error. Put code for a simple DB Query in the button and see does that cause a problem.
If you want you could create two seperate apps to check the combo functionality and query functionality in isolation.
LVL 76

Assisted Solution

GrahamSkan earned 90 total points
ID: 9722414
The idea is that you write information to an external file while the program is running. This is because you can't run it in design mode under Win 98, but only from a compiled .exe

You do this at different places your program by putting calls to the WriteLog procedure, especially those places where you think the progam might be going wrong.

You don't have to write the MyProcedure function. That is to show you a few examples of where you might usefully put the calls in your own procedure(s)

1. WriteLog "MyProcedure: strVariable1 = " & strVariable1 & ", " & "iVariable2" = iVariable2
 at the satrort of the procedure you might want to lst the procedure name and the values of the parameters

2. WriteLog "MyProcedure: " & MyProcedure
You might want to record the value that a function procedure has calculated

3. WriteLog "MyProcedureError: " & Err.Description.
If you have any error handling you can show where the run-time error occurred and what it was.

MaxPol's message boxes are another way of getting the same sort of information, but
a) you would have to remove them all after debugging
b) You may be relying on a remote user accurately to record all the displayed messages


Author Comment

ID: 9727633
MaxPol : thanks for the suggestions. However, compiling my apps take about 10 to 15 minutes per compilation. This is very very time consuming. Even though this might be the easiest way it do take a lot of time.

diarmaid : no, I don't have API calls on my apps. Nice idea regarding the small apps though. I'll take that into consideration.

GrahamSkan : Okay.. thanks for clearing that up.. lemme give it try first.

To all : please give me some time to try all of those solutions you have recommend me. It might take some time as you all can understand judging from the situation.

Thanks a lot. I will come back to close the question or ask for more help when I have more information. Thanks.

Author Comment

ID: 9729016
Hi all,

I ended up using MaxPol suggestion on just one form to find out if there's any brief explanation for the error I'm receiving on the win 98 machines. And I think I'm lucky enough to found out that way ! Here's what I do.

I put messagebox on event/procedure where I thought the error might occur. Strange enough.. those message box doesn't appear on win 2k or win xp, but do appear on win 98. Here's what happen. Remember those combo boxes I was talking about ? well.. on win 2k or win xp, if I click on the dropdown list of the combo boxes and then click somewhere else on the form aside from the combo box, the combo1_lostfocus event would get triggered. Since I have no use of that, I leave that event without any coding at all. HOWEVER, on win98, instead of triggerring the lostfocus event, it goes directly to the combo1_click event ! No wonder error occured, since I'm using the value of the combo boxes for a query to the SQL database, and since I selected nothing from the drop down box, the value of the combo boxes is null or empty, and when being compared to the database nothing is shown.

Anyway.. I'm really relieved that I can get this problem solved without too many things to do. Regarding the points, I would give more points to MaxPol since his suggestion is the one I use, however I would also like to award some points for GrahamSkan since I think he did give me a very good insight on debugging.

Thanks a lot everyone.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question