Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    299

    There is no need to store TPL, so why bother. Se my database (reconnect ListBE first).
    Attached Files Attached Files
    Groeten,

    Peter

  2. #17
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    Yes, but it shouldn't be null. It's just been updated.
    Or if it is null why has the update failed. But will work if done a second time.
    That's what I don't understand.

  3. #18
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    That may well be a better method xps35, I'll try it out. Thanks.
    But I'm intrigued, the function doesn't run, nor does the click event fire now.
    Obviously disabled, but I can't see how and haven't struck this before.

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I also cannot execute code in either file. Ever since I upgraded to Office 2020 I have had issues running code in downloaded databases. Thought I had already set Trusted Location but had to do it just now then close and open each file to get code to run.

    Original code works. If you delete TPL on form, must commit this edit to table before running code again. Use a Refresh or Requery or SaveRecord or If Me.Dirty Then Me.Dirty = False at beginning of procedure.

    Why is TPL a combobox with no RowSource? Make it a textbox - Locked Yes and TabStop No.

    Should be able to update field with a single UPDATE action SQL instead of looping a recordset. However, I agree with xps35, just calculate this value when needed.

    Tracks field is another that could be calculated when needed instead of stored.

    Why are there 254 records in Tracks with the same data? Just for testing?

    Instead of looping records, let SQL aggregate the data.
    Code:
        Set rst = db.OpenRecordset("SELECT Sum(Val(Left(LTrim(TDuration), 2))) AS M, " & _
                "Sum(Val(Right(TDuration, 2))) AS S FROM Tracks WHERE TCat=" & Cat)
    Or use two DSum() expressions to aggregate data.

    Should always have Option Explicit at top of module.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    @June7
    I also cannot execute code in either file. Ever since I upgraded to Office 2020 I have had issues running code in downloaded databases. Thought I had already set Trusted Location but had to do it just now then close and open each file to get code to run.
    Are you aware of this property that only appears for downloaded files?

    Click image for larger version. 

Name:	DL.png 
Views:	18 
Size:	32.9 KB 
ID:	52255

  6. #21
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I do not get that for some reason?
    Attached Thumbnails Attached Thumbnails Download.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Thanks, I may have seen that at some point but forgotten. Maybe this was a 2020 implementation. I jumped from 2010 to 2020.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I do not get that for some reason?
    Did that file come from the internet (and the protection was never removed)? If not, I think you don't see the option.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #24
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Quote Originally Posted by Micron View Post
    Did that file come from the internet (and the protection was never removed)? If not, I think you don't see the option.
    Yes, that is a DB I downloaded from some Access site. That is why it is in the downloads folder on my NAS box. That is so any downloads can be accessed from any computer.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #25
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    If you open an object (like a recordset), you should close it.

    Aside from all that, why can you not achieve this with a maybe parameterized update query? It's a good thing you can't store a billion rows in an Access database, because this would force it to a crawl.

  11. #26
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    @jUNE7
    Thanks, I may have seen that at some point but forgotten. Maybe this was a 2020 implementation. I jumped from 2010 to 2020.
    it's a Windows thing, not just Access. Applies to any downloaded file, I think. At least any File that Microsoft deems capable of execution.

  12. #27
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    I was able to run the db from xp35 as per daveGri advice. I had seen that before on some images and music files. I have a VB6 routine that removes it.
    Ok on calculating a value than than storing it.
    June, yes the table was just data to process, and I'll make the combo a textbox. It was good to get the answer must commit this edit to table before running code again.
    That's what I thought Me.Refresh (or Me.requery) did. But I see both If Me.Dirty... and Me.Refresh are needed.
    Thanks for the info and solution. Very good to get past this, and now I'll use calculated method as suggested.

  13. #28
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If Me.Dirty and Me.Refresh should not both be needed.

    Refresh worked in my test.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date difference of every 2nd record in a field
    By UnlucksMcGee in forum Access
    Replies: 7
    Last Post: 01-06-2018, 10:33 PM
  2. Replies: 7
    Last Post: 10-20-2015, 03:25 PM
  3. Replies: 1
    Last Post: 02-08-2015, 08:11 PM
  4. Replies: 9
    Last Post: 01-08-2015, 12:34 PM
  5. Replies: 8
    Last Post: 11-07-2013, 08:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums