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

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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

As a general rule, you should develop in the earliest environment that you intend to support.
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

hama-ayu-ismAuthor Commented:
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.

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

hama-ayu-ismAuthor Commented:
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 ?

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.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
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

hama-ayu-ismAuthor Commented:
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.
hama-ayu-ismAuthor Commented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.