Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error 13

Status
Not open for further replies.

Smithsco

Technical User
Mar 30, 2003
89
AU
I did a search and it appears this error has poped up before, just not in the same way.

I have a program that uses multiple forms and DAO to access a 2k DB.

The program works fine on winxp/2k however on win98se there is an issues switching forms!

All forms use the same format to switch form2.show then unload form1
All but one works.
When the form loads it pulls data from the DB and loads it into the first combo fields (this is what happens in the first form as well).

The client just has the EXE file and MDB, which works on all other Win2k/XP machines. I havew created a package and sent that to them to install but if any one else has any Idea's that would be great.
 
You have a type mismatch, you will need to post alot more information if you want help.
 
What sort of info do you need?
Also wouldn't a type mismatch also occur on WinXP and Win2k?

The packaged install also had the same problem.
 
I have no idea what you are doing. But there are plenty of libraries that have changed since win98. Plus don't forget the 2000/Xp is Unicode based and win98 is ascii bases. So you maybe using the incorrect API call. Again there are many things that it could be. Start by explaining What DAO version you are using and what else you are using. Also are the versions of MsAccess the same?
Let's start there, and see if the problem may be there somewhere
 
I'm using DAO 3.6, the machine, the WinXP machine is the only machine with access installed on it.
I'm using a very basic form, they have combobox, list boxs, text boxes and labels and a few picture boxes used as buttons.

I don't think I am calling any API's
I have serveral Integer variables and 3 string values
I'm access the databas by

dim db as database
dim rs as recordset
dim SQLString as string

set db = opendatabase("c:\blah\test.mdb")
sqlstring = "select stuff" & _
"From stoff ON other Stuff INNER JOIN lotsastuff
"Where combo1.text AND combo2.text"
set rs = db.openrecordset(SQLString)
test1 = rs.fields("blah")
rs.close
db.close

(Example string only)
All the other strings etc are unsed in Case or I events and used to work out values, nothing special.
I'm currently not posting the code as its about 20 pages long :)


 
And you are sure that the Win98Se Machine that you are having problems with also has 3.6. Or may it have the 2.51/3.51 compatability version?
 
The first form that loads pulls data using DAO so there does not seem to be a problem here, I have also included the DAO in the package deployment, to make sure.

I have 4 main forms, when each forms loads it pulls names from the DB and adds them to a combo box.It is only the "range" form that has the problem and only on wni98se (WIn2k and XP work fine), all for forms are basically the same, the only difference that I can think of is I have a string called rng.
 
The error occurs some time between

Rangedice.Show
Unload Meleedice

and
Dim I As Integer
Dim a As Integer
Dim dice As Integer
Dim Rng As String
Dim Mdls As Integer
Dim WpnS As Integer
Dim wpname As String
Dim Charge As Integer
Dim wards As Integer
Dim wardk As Integer
Dim ldtst As Integer
Dim selected As Integer
Dim db As Database
Dim rs As Recordset
Dim SQLString As String

Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\test.mdb")
SQLString = "SELECT name.fname " & _
"FROM name; "

Set rs = db.OpenRecordset(SQLString)

If rs.BOF = True And rs.EOF = True Then
MsgBox ("Cannot find Unit")
rs.Close
db.Close
Exit Sub
End If

While rs.EOF = False
Combo1.AddItem rs.Fields("fname")
Combo3.AddItem rs.Fields("fname")
rs.MoveNext
Wend
rs.Close
db.Close
Rng = "range"
wards = 0
End Sub

 
OK the error is being caused by my Icon (the range form was the only one that had it), are there any restrictions to Icon size etc that I need to be aware of?
 
One possibility is that it's a timing issue. Since the error is occurring in the Form_Load event, it's quite possible that you're trying to reference an entity that is not quite ready. This can vary from system to system because it's a timing situtation and is dependant on how quickly any particular system can get things set up and ready.

I would suggest that you move the code to the Form_Activiate event, which shouldn't fire until all of the form initializations are complete.

If that doesn't work, then you could put some error handling in the code, or you could try putting in some footprints to identify the specific line on which the error occurs.

You also may want to check for the value of the App.Path property. It is not safe to assume that the trailing backslash is or is not included. I would do something like the following:

Pathname = Trim(App.Path)
If (Right(Pathname, 1) <> &quot;\&quot;) Then
Pathname = Pathname & &quot;\&quot;
End If

You may also want to insure that the value of &quot;fname&quot; as coming from the database is not something unusual.


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top