Results 1 to 26 of 26

Thread: VB6 Won't Update mdb database

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    VB6 Won't Update mdb database

    VB6 app developed on Win XP with DAO 3.6. Compiles and runs in XP with
    the db updating correctly. When app.exe file is copied to and run
    in Windows server 2012, the app runs and sees the incoming data but will not
    write to the mdb database. Any ideas?? Thanks.

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,765

    Re: VB6 Won't Update mdb database

    Depends what you mean by, will not write to the mdb database. What happens? Nothing, throws an error.....

    Also, posting the code that write to the db would be helpful.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    OK Some more info:
    The runtime runs on the server 2012 and the field values can be seen updating. The database exists
    on that server but the record never updates.

    Dim DBASE As Database
    Dim SYS1 As Recordset
    Set DBASE = OpenDatabase("\\b0254S25\MONITOR\rtdata_2003_Backup.mdb", False, False)
    Set SYS1 = DBASE.OpenRecordset("SYSTEM", dbOpenTable, dbSeeChanges, dbPessimistic)

    SYS1.Edit
    SYS1(1) = Year(Date)
    SYS1(2) = MONTH(Date)
    SYS1(3) = Day(Date)
    SYS1.Update

    Microsoft DAO 3.6 library is referenced

  4. #4
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,825

    Re: VB6 Won't Update mdb database

    what record do you want to edit ?
    the first
    the last

    Code:
    Set SYS1 = DBASE.OpenRecordset("SYSTEM", dbOpenTable, dbSeeChanges, dbPessimistic)
    
    SYS1.Edit
    SYS1(1) = Year(Date)
    SYS1(2) = MONTH(Date)
    SYS1(3) = Day(Date)
    SYS1.Update
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    SYSTEM is a single record in the SYS1 recordset. That record needs to be updated with the field values for SYS1(0), SYS!(1), etc.

  6. #6
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,661

    Re: VB6 Won't Update mdb database

    At a guess: Somewhere is an OERN masking the actual error (probably write-access rights)

    EDIT: Just found something
    dbSeeChanges 512 Generates a run-time error if another user is changing data you are editing (dynaset-type only).
    Last edited by Zvoni; Jul 12th, 2021 at 01:39 AM.
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    Zvoni, Apologies but I don't know how to use the info you offered.

  8. #8
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,661

    Re: VB6 Won't Update mdb database

    Do you have an On Error Resume Next beforehand?
    Since you said it worked on XP, but not on 2012 i'm guessing write-access issues with the folder the mdb-file is placed in
    Check your rights on that particular Share and/or your rights for the mdb-file itself. You need write-access to the folder/file itself


    You're using dbOpenTable, but dbSeeChanges only makes sense with dbOpenDynaset
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  9. #9

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    Zvoni, The db is not write protected. I believe the issue is with which version of msaccess is at play. We have a parallel application running on the server which was developed on the same WinXP laptop which writes into its own db. Any thoughts on DAO vs. ADO that might have changed? Both databases can be opened in Access and report as "Access 2002-2003 file format".

  10. #10
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,661

    Re: VB6 Won't Update mdb database

    I wasn't talking about write-protected (in this Property-Tab of the File-Properties)
    I'm talking about access-rights to the Folder/File (In that Property-Window on Tab Security or whatever it's called): You need write-access there.

    I don't think it's the version of access installed, since your app is written in VB6, and you connect to the Database using the Jet-Engine (DAO)

    DAO vs. ADO: DAO is dead. Use ADO
    Another thought: Maybe updating/converting from mdb to accdb but since the last time i used an access-database is some 20 years ago, i'll leave that can of worms to others.
    There might be issues with different Access-runtimes i have no clue about
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  11. #11
    Member
    Join Date
    Nov 2020
    Posts
    60

    Re: VB6 Won't Update mdb database

    Quote Originally Posted by bgiffow View Post
    Zvoni, The db is not write protected. I believe the issue is with which version of msaccess is at play. We have a parallel application running on the server which was developed on the same WinXP laptop which writes into its own db. Any thoughts on DAO vs. ADO that might have changed? Both databases can be opened in Access and report as "Access 2002-2003 file format".
    Instead of dbOpenTable use dbOpenDynaset

    https://docs.microsoft.com/en-us/off...numeration-dao

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

    Re: VB6 Won't Update mdb database

    Quote Originally Posted by LeoFar View Post
    Instead of dbOpenTable use dbOpenDynaset

    https://docs.microsoft.com/en-us/off...numeration-dao
    Leo, doesn't explain his statement, why it worked on XP, since his client is written in VB6.

    What i just noticed: He said that he moved the app to the server, too, and that it runs there.
    My Question is: Is it really running ON the server (as in process-space), or does someone use a link to the app from a client-computer?
    Because in that case, the app would run in the process-space of the client-computer, not on the server, and there might be issues with runtimes installed locally
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  13. #13

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    To confirm: the app.exe was copied to the server and runs there.

  14. #14
    Member
    Join Date
    Nov 2020
    Posts
    60

    Re: VB6 Won't Update mdb database

    Quote Originally Posted by bgiffow View Post
    To confirm: the app.exe was copied to the server and runs there.
    The app is always run on the client computer that launches it (locally), no matter where the exe is located.

  15. #15

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    That's what I was trying to say. The app.exe and its database are on the server. We log into the server and launch the app from there. The server has no access to the laptop that generated the runtime.

  16. #16
    Member
    Join Date
    Nov 2020
    Posts
    60

    Re: VB6 Won't Update mdb database

    Quote Originally Posted by bgiffow View Post
    That's what I was trying to say. The app.exe and its database are on the server. We log into the server and launch the app from there. The server has no access to the laptop that generated the runtime.
    All business programs work like this, unless the program is structured in two distinct parts: a Client and a Server.

  17. #17
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,661

    Re: VB6 Won't Update mdb database

    OK, the only thing left:
    Please test on the server moving the App and mdb-file to a another (public?) folder, where access-rights are on "full access" (or whatever it's called), and test there.
    If it doesn't run it's a machine-problem, if it runs, then it's the folder where the mdb-file is located
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  18. #18

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    OK. The complete package was prepared from the development code. The package, a copy of the database and the app.exe were all copied to a separate computer running Win 10. The setup.exe for the package was run and installed successfully. The data collection portion of the program is working correctly but the database is not being updated. This continues to smell like an msaccess problem.

  19. #19
    Frenzied Member
    Join Date
    Nov 2017
    Posts
    1,657

    Re: VB6 Won't Update mdb database

    Quote Originally Posted by bgiffow View Post
    This continues to smell like an msaccess problem.
    I hope you have a good rhinologist.

    It seems unlikely to me that Access is the culprit. I don't believe you've ever addressed the questions about any error handling in your code, specifically involving methods that interact with the database. If you are suppressing any errors, either via On Error Resume Next, or having a blank Error handler routine, then you should be commenting out the "On Error" lines of code, let any potential errors be thrown, and see what they are. That would be the first breadcrumb towards resolution.

    Also, I'm assuming you've verified this, but have you tried to browse to the exact UNC path that the database file is located on (referenced in post 3 above) while logged in to this server as this user? And verified that this user account has read/write/modify capabilities with content in that UNC path?

  20. #20

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    I will continue down that path. Now if coworkers will leave me alone for a bit, I'll get focused.

  21. #21
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,338

    Re: VB6 Won't Update mdb database

    the first thing that comes to my mind is: windows folder redirection (whats the damn correct name of this? forgot..). i.e. you cant write to the program folder and others but you get silently redirected to other folders. so you may not use the mdb file you intended to...

  22. #22
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,627

    Re: VB6 Won't Update mdb database

    you can test save recordset in server pc :b0254S25
    and make a winsock control for send cmd by other computer.

    Just like the server itself has installed N types of databases, the client only needs to open the web page to read and write the database, realizing the separation of front-end and back-end

  23. #23
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,627

    Re: VB6 Won't Update mdb database

    The unit I worked in last year forced the use of ACCESS to read and write databases on the LAN. It took 200 seconds to connect successfully, which was often unstable. It only takes 200 milliseconds to connect to SQL SERVER. Therefore, it is the correct way to use a TCP type network database for communication between multiple computers. Otherwise, if the server database MDB has 200M, it also needs to be read out and then modified. The hard disk io pressure is very high and it is easy to damage the database. , Reading and writing are also very slow.

  24. #24
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,627

    Re: VB6 Won't Update mdb database

    Running the compiled EXE directly, running on different operating systems will also cause errors or inconsistent results. You can install VB6 directly on SERVER 2012 and try it directly with the source code, and then compile it into EXE

  25. #25

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    OK Folks. This topic is on hold for the moment while I get thru the error tracing per OptionBase1 above. Thanks.

  26. #26

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    11

    Re: VB6 Won't Update mdb database

    Problm resolved! I'm no expert but the following allowed a VB6 application
    to write to an access database residing on a R2012 server along with the application
    executable. The application development was done on Win XP due to old proprietary
    controls. The issue turned out to be mismatched references in the database when it
    was migrated to the server. In particular, the Microsoft Access 16.0 Object Library
    did not like my VB6 executable.

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