|
-
Jul 13th, 2022, 02:12 AM
#1
Thread Starter
Member
Project gets stuck when running on Apple computer
My project written in VB 6.0 under Windows 10 is working perfectly.
When I use the same project on An Apple computer with VB 6.0 under Windows 10, when I run the project it gets stuck without showing any errors.
I put breakpoints in the starting form and I found out that it gets stuck after running the code :
Set rec1 = db1.OpenRecordset("Table2", dbOpenTable)
Before this code, I have the following code in Private Sub Form_Load()
Dim db1 As Database
Dim rec1 As Recordset
On Error Goto HandleErrors
Set db1 = OpenDatabase(App.Path & "\DataFiles\data2.mdb", False, False)
Set rec1 = db1.OpenRecordset("Table2", dbOpenTable)
The references selected are:
Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft Data Formatting Object Library 6.0 (SP6)
Microsoft Excel 16.0 Object Library
Microsoft Data Binding Collection VB 6.0 (SP4)
Microsoft Data Report Designer 6.0 (SP4)
Microsoft Scripting Runtime
Microsoft Script Host Object Model
Microsoft ActiveX Data Objects 2.8 Library
Microsoft ActiveX Data Objects Recordset 2.8 Library
Microsoft WinHTTP Services, version 5.1
Microsoft XML, v6.0
Any suggestions?
-
Jul 13th, 2022, 03:03 AM
#2
Fanatic Member
Re: Project gets stuck when running on Apple computer
If I remember correctly .mdb is an access database. Does the apple box have access installed (if it shipped for apple) and can you open the database with that?
-
Jul 13th, 2022, 03:04 AM
#3
Re: Project gets stuck when running on Apple computer
It's just running on Windows 10, so the type of computer, in this case an Apple, should not matter.
Is OpenDataBase a part of DAO or is it a self written function?
What is the location of your application? I ask this because you have stored the DB file in a sub folder of the application.
-
Jul 13th, 2022, 03:30 AM
#4
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
It's just running on Windows 10, so the type of computer, in this case an Apple, should not matter.
Is OpenDataBase a part of DAO or is it a self written function?
What is the location of your application? I ask this because you have stored the DB file in a sub folder of the application.
That's DAO, definitely (as you can see in his References).
But why he's referencing ADO too, escapes me.
Next: Is Excel/Office installed on that VM? (I'm guessing he runs Win10 in a VM on the Apple)
Lastly: App.Path & "\DataFiles....."
Depending how/where he installed his vb6-exe it might be running into a Write-Protect
IIRC, opening a mdb-file tries to create a loc-file?
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 13th, 2022, 05:06 AM
#5
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
It's just running on Windows 10, so the type of computer, in this case an Apple, should not matter.
Is OpenDataBase a part of DAO or is it a self written function?
What is the location of your application? I ask this because you have stored the DB file in a sub folder of the application.
OpenDatabase is a part of DAO. The DB file is stored in a sub folder of the application this is true
-
Jul 13th, 2022, 05:07 AM
#6
Re: Project gets stuck when running on Apple computer
And where is the application located? In a restricted (sub) folder like "Program Files"?
-
Jul 13th, 2022, 05:09 AM
#7
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Zvoni
That's DAO, definitely (as you can see in his References).
But why he's referencing ADO too, escapes me.
Next: Is Excel/Office installed on that VM? (I'm guessing he runs Win10 in a VM on the Apple)
Lastly: App.Path & "\DataFiles....."
Depending how/where he installed his vb6-exe it might be running into a Write-Protect
IIRC, opening a mdb-file tries to create a loc-file?
Win10 is installed in a partiotion on the Apple and Ms Office 16.0 is installed.
What do you mean by "how/were vb6.0 is installed"?
-
Jul 13th, 2022, 05:14 AM
#8
Re: Project gets stuck when running on Apple computer
Not VB6.exe, your application. What is the location (path) of your application?
-
Jul 13th, 2022, 05:20 AM
#9
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
Not VB6.exe, your application. What is the location (path) of your application?
It is in the folder "Application1", c:\Application1 and under this path are the data in a subfolder
-
Jul 13th, 2022, 06:14 AM
#10
Re: Project gets stuck when running on Apple computer
Then in theory there should not be a problem with opening and reading the DB file.
I put breakpoints in the starting form and I found out that it gets stuck after running the code :
Set rec1 = db1.OpenRecordset("Table2", dbOpenTable)
So the last line does complete?
If yes, what are the next lines of code?
-
Jul 13th, 2022, 06:57 AM
#11
Re: Project gets stuck when running on Apple computer
App.Path may or may not contain already the last slash "/", so the code.
Code:
Set db1 = OpenDatabase(App.Path & "\DataFiles\data2.mdb", False, False)
is not correct.
If the exe it in the root of the disk, like C:\, it already contain the "".
I usually replace App.Path by a function:
Code:
Set db1 = OpenDatabase(App_Path & "\DataFiles\data2.mdb", False, False)
In a module:
Code:
Public Function App_Path() As String
App_Path = App.Path
If Right$(App_Path, 1) <> "\" Then App_Path = App_Path & "\"
End Function
Public if you put it on a module, but if you put this on the form's code, it can be private.
-
Jul 13th, 2022, 08:04 AM
#12
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
Then in theory there should not be a problem with opening and reading the DB file.
So the last line does complete?
If yes, what are the next lines of code?
Remember: he has an active Error-Handler
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 13th, 2022, 08:20 AM
#13
Re: Project gets stuck when running on Apple computer
 Originally Posted by dimbil
it gets stuck after
"it gets stuck" is not very precise...
Are you running it in the IDE?
What error do you have?
Remove the error handler to see what is happening.
-
Jul 13th, 2022, 08:23 AM
#14
Re: Project gets stuck when running on Apple computer
Is there an error or does the application freeze??
-
Jul 13th, 2022, 08:53 AM
#15
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
Then in theory there should not be a problem with opening and reading the DB file.
So the last line does complete?
If yes, what are the next lines of code?
No, the last line of code doesn't complete. This is the line of code where it gets stuck when executing
-
Jul 13th, 2022, 08:54 AM
#16
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
Is there an error or does the application freeze??
There is no error. The application freezes
-
Jul 13th, 2022, 08:56 AM
#17
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Eduardo-
"it gets stuck" is not very precise...
Are you running it in the IDE?
What error do you have?
Remove the error handler to see what is happening.
There is no error. I will remove the error handler and I will tell you what is happening.
-
Jul 13th, 2022, 09:05 AM
#18
Re: Project gets stuck when running on Apple computer
 Originally Posted by dimbil
There is no error. I will remove the error handler and I will tell you what is happening.
Check if "db1" is a valid (Database)-Object (in Watch-Window?). Maybe OpenDatabase fails and returns "Nothing"
EDIT: Wait a sec. He has DAO and ADO referenced, but his "Dim rs1 As Recordset" is not qualified if it's a DAO or ADO-Recordset.
That said: It's really weird, because there should be some explicit errors
And do you really need all those References? I'd try remove one after the other (going Bottom-Up. Start with the last)
Last edited by Zvoni; Jul 13th, 2022 at 09:09 AM.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 13th, 2022, 09:36 AM
#19
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Zvoni
Check if "db1" is a valid (Database)-Object (in Watch-Window?). Maybe OpenDatabase fails and returns "Nothing"
EDIT: Wait a sec. He has DAO and ADO referenced, but his "Dim rs1 As Recordset" is not qualified if it's a DAO or ADO-Recordset.
That said: It's really weird, because there should be some explicit errors
And do you really need all those References? I'd try remove one after the other (going Bottom-Up. Start with the last)
Yes, I need all those references.
Ona normal PC with VB6.0 under Windows 10 the code is working perfectly.
Maybe I should change "Dim rs1 As Recordset" to "Dim rs1 As ADO.Recordset" ?
-
Jul 13th, 2022, 10:04 AM
#20
Re: Project gets stuck when running on Apple computer
No, you are using DAO to open the database, so you should use DAO references everywhere!
And again it's a normal computer running Windows 10.
Is it running on a Virtual Machine with something like Parallels or is Boot Camp used?
https://machow2.com/best-way-run-windows-mac/
Last edited by Arnoutdv; Jul 13th, 2022 at 10:11 AM.
-
Jul 13th, 2022, 10:34 AM
#21
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
No, you are using DAO to open the database, so you should use DAO references everywhere!
And again it's a normal computer running Windows 10.
Is it running on a Virtual Machine with something like Parallels or is Boot Camp used?
https://machow2.com/best-way-run-windows-mac/
But before this reference, in the same form, I use another one which runs normally with no problems.
This is as follows:
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase(App.Path & "\DataFiles\data1.mdb", False, False)
Set rec = db.OpenRecordset("Table1", dbOpenTable)
-
Jul 13th, 2022, 10:35 AM
#22
Re: Project gets stuck when running on Apple computer
Maybe the the table “Table2” is corrupt?
Did you check the actual database file?
-
Jul 13th, 2022, 11:29 AM
#23
Re: Project gets stuck when running on Apple computer
 Originally Posted by dimbil
But before this reference, in the same form, I use another one which runs normally with no problems.
This is as follows:
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase(App.Path & "\DataFiles\data1.mdb", False, False)
Set rec = db.OpenRecordset("Table1", dbOpenTable)
I would fully qualify the type declaration if you have both libraries referenced, just to be sure.
Code:
Dim db As DAO.Database
Dim rec As DAO.Recordset
-
Jul 13th, 2022, 01:18 PM
#24
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
I tried this but didn't correct the problem
-
Jul 13th, 2022, 01:19 PM
#25
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
I am running it in the IDE.
I removed the error handler but it didn't help. The problem still exists
-
Jul 13th, 2022, 02:01 PM
#26
Re: Project gets stuck when running on Apple computer
Hmmm….. OP said he has Win10 on a separate partition of this (Apple) Harddrive.
i‘m not familiar with Apple (APFS?) but maybe it‘s the harddisk-controller messing stuff up when trying to read/write to NTFS
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 13th, 2022, 03:28 PM
#27
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
Is it running on a Virtual Machine with something like Parallels or is Boot Camp used?
Bootcamp is not a virtual machine. It does not run under MacOS as it's just another boot partition.
Edit: Sorry did not see "or is" just saw "or".
-
Jul 13th, 2022, 04:57 PM
#28
Re: Project gets stuck when running on Apple computer
 Originally Posted by Zvoni
Hmmm….. OP said he has Win10 on a separate partition of this (Apple) Harddrive.
i‘m not familiar with Apple (APFS?) but maybe it‘s the harddisk-controller messing stuff up when trying to read/write to NTFS
It’s just a computer with a normal hdd/ssd. Nothing to do with the Apple file system
-
Jul 14th, 2022, 02:14 AM
#29
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
It’s just a computer with a normal hdd/ssd. Nothing to do with the Apple file system
No, it's not.
 Originally Posted by dimbil
Win10 is installed in a partiotion on the Apple and *snipp*
Is this even legal?
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 14th, 2022, 02:46 AM
#30
Re: Project gets stuck when running on Apple computer
 Originally Posted by Zvoni
No, it's not.
Yes it is, if you use Boot Camp.
The same as if you install Linux and Windows as dual boot on a 'normal' PC.
But you can also use Parallels and run Windows 10 side by side
 Originally Posted by Zvoni
Is this even legal?
Yes of course, just buy a Windows 10/11 license and install it.
From the Apple website:
https://support.apple.com/guide/mac-...ac-mh11850/mac
Last edited by Arnoutdv; Jul 14th, 2022 at 03:03 AM.
-
Jul 14th, 2022, 04:14 AM
#31
Re: Project gets stuck when running on Apple computer
Then the last thing coming to mind would be, if his Office is a "Pro" and if he can open the mdb in Access directly
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 14th, 2022, 06:58 AM
#32
Fanatic Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by Arnoutdv
It's just running on Windows 10, so the type of computer, in this case an Apple, should not matter.
Is OpenDataBase a part of DAO or is it a self written function?
What is the location of your application? I ask this because you have stored the DB file in a sub folder of the application.
Sorry. Poor reading on my behalf
-
Jul 14th, 2022, 07:08 AM
#33
Re: Project gets stuck when running on Apple computer
 Originally Posted by dimbil
I am running it in the IDE.
I removed the error handler but it didn't help. The problem still exists
Have you tried open the actual DB file directly from MS-Access on the Apple computer?
Or copy the DB file to another computer to check the integrity of the DB file
-
Jul 14th, 2022, 07:57 AM
#34
Re: Project gets stuck when running on Apple computer
Sorry if this has already been said. I read over most of the posts here but not all.
You say it freezes. Have you tried hitting break in the IDE when it freezes to see if it show you where it is having an issue?
Have you tried steeping through the code to see where it hangs?
Have you tried adding any debug or logging code to get an idea of what it happening at run time?
Clearly you are using DAO for the db operations. Is there a reason you have ADO referenced also? Typically you would use one or the other not both.
-
Jul 15th, 2022, 10:05 AM
#35
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by cidtek
Bootcamp is not a virtual machine. It does not run under MacOS as it's just another boot partition.
Edit: Sorry did not see "or is" just saw "or".
It runs under windows 10 installed in a partition of apple
-
Jul 15th, 2022, 10:08 AM
#36
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
I am using both DAO and ADO db operations ince they were working perfectly on a PC with Windows 10. The problem is when running the project on an apple computer. I will change my code using only DAO to see if it will run
-
Jul 15th, 2022, 10:10 AM
#37
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
I have done it and the DB file opens regularly on the apple computer
-
Jul 15th, 2022, 11:11 PM
#38
Re: Project gets stuck when running on Apple computer
I see you did not answer the questions about have you tried using break, logging or stepping through the code to see where it is actually hanging up.
This should be your first step. Much easier to fix a problem once you know where the problem occurs.
-
Jul 18th, 2022, 04:22 AM
#39
Thread Starter
Member
Re: Project gets stuck when running on Apple computer
 Originally Posted by DataMiser
I see you did not answer the questions about have you tried using break, logging or stepping through the code to see where it is actually hanging up.
This should be your first step. Much easier to fix a problem once you know where the problem occurs.
I have used breakpoints and the code is hanging up when executing the command Set rec = db.OpenRecordset("Table1", dbOpenTable)
-
Jul 18th, 2022, 07:21 AM
#40
Re: Project gets stuck when running on Apple computer
Then I still think your DB file is corrupted.
Because you said earlier that following does work
Code:
Set rec = db.OpenRecordset("Table2", dbOpenTable)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|