Page 1 of 2 12 LastLast
Results 1 to 40 of 45

Thread: Project gets stuck when running on Apple computer

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    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?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2019
    Posts
    316

    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?

  3. #3
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    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.

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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?
    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

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    And where is the application located? In a restricted (sub) folder like "Program Files"?

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Zvoni View Post
    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"?

  8. #8
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Not VB6.exe, your application. What is the location (path) of your application?

  9. #9

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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

  10. #10
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    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?

  11. #11
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,431

    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.

  12. #12
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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
    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

  13. #13
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,431

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by dimbil View Post
    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.

  14. #14
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Is there an error or does the application freeze??

  15. #15

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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

  16. #16

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    Is there an error or does the application freeze??
    There is no error. The application freezes

  17. #17

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Eduardo- View Post
    "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.

  18. #18
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by dimbil View Post
    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.
    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

  19. #19

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Zvoni View Post
    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" ?

  20. #20
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    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.

  21. #21

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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)

  22. #22
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Maybe the the table Table2 is corrupt?
    Did you check the actual database file?

  23. #23
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,431

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by dimbil View Post
    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

  24. #24

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    I tried this but didn't correct the problem

  25. #25

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    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

  26. #26
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    Re: Project gets stuck when running on Apple computer

    Hmmm.. OP said he has Win10 on a separate partition of this (Apple) Harddrive.
    im not familiar with Apple (APFS?) but maybe its the harddisk-controller messing stuff up when trying to read/write to NTFS
    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

  27. #27
    New Member
    Join Date
    Jun 2017
    Posts
    8

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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".

  28. #28
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Zvoni View Post
    Hmmm.. OP said he has Win10 on a separate partition of this (Apple) Harddrive.
    im not familiar with Apple (APFS?) but maybe its the harddisk-controller messing stuff up when trying to read/write to NTFS
    Its just a computer with a normal hdd/ssd. Nothing to do with the Apple file system

  29. #29
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    Its just a computer with a normal hdd/ssd. Nothing to do with the Apple file system
    No, it's not.
    Quote Originally Posted by dimbil View Post
    Win10 is installed in a partiotion on the Apple and *snipp*
    Is this even legal?
    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

  30. #30
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Zvoni View Post
    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

    Quote Originally Posted by Zvoni View Post
    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.

  31. #31
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,341

    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
    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

  32. #32
    Hyperactive Member
    Join Date
    Mar 2019
    Posts
    316

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by Arnoutdv View Post
    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

  33. #33
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by dimbil View Post
    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

  34. #34
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,095

    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.

  35. #35

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by cidtek View Post
    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

  36. #36

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    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

  37. #37

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    I have done it and the DB file opens regularly on the apple computer

  38. #38
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,095

    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.

  39. #39

    Thread Starter
    Member
    Join Date
    Nov 2012
    Posts
    58

    Re: Project gets stuck when running on Apple computer

    Quote Originally Posted by DataMiser View Post
    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)

  40. #40
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,343

    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)

Page 1 of 2 12 LastLast

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
  •  



Click Here to Expand Forum to Full Width