Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39
  1. #16
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398


    my issue is "Why no fields attached to record. It reads 37,818 records , then exits"

    in your original code you are returning recordcount immediately after opening the recordset - this will return 0 until the recordset is fully loaded. You need to .movelast before checking the recordcount


    Error 3265 - Item cannot be found in the collection corresponding to the requested name or ordinal. This error is usually caused by a field missing from the database.

    In your original code you have

    txt1 = rs!ImlJobID

    in your query you have

    m1tclcropped.lmlJobID

    looks to me like they are different - original
    ImlJobID, querylmlJobID

    seriously doubt this has ever worked pre 365 or not

  2. #17
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    I'll bet you aren't getting an accurate recordcount

    Add a debug.print :

    Code:
    If rs.RecordCount = 0 Then Exit Sub
    rs.MoveFirst
    Debug.Print rs.RecordCount
    For XX = 1 To rs.RecordCount
    Now when it says -1 or something equally weird add the move last command.

    Edit: I see CJ beat me to it, but that post wasn't there when I looked 5 minutes ago...? ?

    Code:
    If rs.RecordCount = 0 Then Exit Sub
    rs.MoveLast
    rs.MoveFirst
    Debug.Print rs.RecordCount
    For XX = 1 To rs.RecordCount
    And see what you get...
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Guys,
    Code:
    SQL = "SELECT * FROM query1"
    ' SQL = "SELECT * FROM m1tclcropped"
    Set rs = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
    


    That is what I was going on?
    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

  4. #19
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    @WGM - the picture in the previous page is showing Query1 being used with records being returned?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by Minty View Post
    @WGM - the picture in the previous page is showing Query1 being used with records being returned?
    Oops sorry, missed that post as I went straight to the second page for some reason?
    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

  6. #21
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by homelessvet1 View Post
    Attachment 49539
    Actually, it does. Querys won't report what isn't there.

    I've been writing code since 1980 and still can't prove a negative.
    Wow!, and never used Option Explicit or ever heard of it?

    Don't need me then, I was still an engineer back then.
    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
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    actually, in this instance, Option Explicit wouldn't have generated a compile error because rs!ImlJobID is late bound. The error would have been generated at runtime

  8. #23
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by CJ_London View Post
    actually, in this instance, Option Explicit wouldn't have generated a compile error because rs!ImlJobID is late bound. The error would have been generated at runtime
    I was thinking of the XX
    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

  9. #24
    Join Date
    Jan 2023
    Posts
    15
    Can we stick to the issue? Recordset has no fields attached. Have used option explicit many times, have no problem with it. This will be just data conversion/reformat program.

  10. #25
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    So have you checked the record count?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  11. #26
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I think it's time to post a db copy that you've compact/repaired and zipped. See "How to Attach Files" at the top if you agree.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #27
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    have you read and understood post #16? Does fixing the two issues as suggested solve your problem

  13. #28
    Join Date
    Jan 2023
    Posts
    15
    Yes, it is accurate.

  14. #29
    Join Date
    Jan 2023
    Posts
    15
    At rs.open.. the record count = 1.
    At movelast it is 37,818
    At movefirst it is 37,818
    ImlJobID is stll not attached to rs recordset

  15. #30
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    Yes, it is accurate.
    what does that mean?

    if you debug.print rs.recordcount you get 37818? even though the code exits if it is 0 which is what you are saying it is doing?

    You expect the code to interpret ImlJobID as lmlJobID?

    you can see from your own code the I of ID


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

Similar Threads

  1. Filter Recordset by record count
    By jcc285 in forum Programming
    Replies: 14
    Last Post: 12-05-2017, 09:40 AM
  2. Replies: 4
    Last Post: 12-20-2015, 12:16 PM
  3. Replies: 12
    Last Post: 08-14-2012, 07:06 AM
  4. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  5. Replies: 1
    Last Post: 11-13-2009, 03:03 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