Solved

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

Posted on 2003-11-10
11
297 Views
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.

Thanks
0
Comment
Question by:hama-ayu-ism
11 Comments
 
LVL 76

Expert Comment

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

0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
As a general rule, you should develop in the earliest environment that you intend to support.
0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
0
 

Author Comment

by:hama-ayu-ism
Comment Utility
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.

Thanks
0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
MyProcedurExit:
WriteLog "MyProcedure: " & MyProcedure
    Exit Function
MyProcedureError:
    WriteLog "MyProcedureError: " & Err.Description
    Select Case Err.Number
        Case 12345, 67890 '(say)
            Resume Next
        Case Else
            Resume MyProcedurExit
    End Select
   
End Function



0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:hama-ayu-ism
Comment Utility
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 ?

Thanks
0
 
LVL 2

Accepted Solution

by:
MaxPol earned 110 total points
Comment Utility
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.

i.e.

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.

Bye,

Max
0
 
LVL 2

Expert Comment

by:diarmaid
Comment Utility
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.
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 90 total points
Comment Utility
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

   
   
0
 

Author Comment

by:hama-ayu-ism
Comment Utility
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.
0
 

Author Comment

by:hama-ayu-ism
Comment Utility
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.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now