Results 1 to 4 of 4
  1. #1
    George is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2012
    Posts
    295

    Identifying the last field in a query

    Good Day All.

    My record set is "rst". it is used to find records by the code "rst.fields(1)" etc. The source query has 8 fields ( I count them 30 times). However with this code I can only access the first 7 fields. The 8th gives the error message "Item not found in this collection".

    I also used the field name "rst.fields("Invoice ID") but to no avail.

    I would be grateful for assistance solving this problem.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Not sure if you realize the field count of a recordset is zero based. If you're starting with (1), you're really on field 2. That could explain it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Advise no spaces nor punctuation/special characters (underscore only exception) in naming convention.
    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.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    on forms and real life, counting starts at 1.
    in VB , items begin counting with zero. (recordsets, listboxes, etc)

    rst.fields.count = (8)
    but only rst.fields(7).value is the 8th item.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 10-24-2015, 01:45 PM
  2. Identifying the field in a subform
    By zareh in forum Forms
    Replies: 25
    Last Post: 03-07-2014, 07:43 PM
  3. Replies: 11
    Last Post: 04-19-2012, 03:28 PM
  4. Need help identifying what to do....?
    By shands in forum Access
    Replies: 7
    Last Post: 09-29-2011, 11:49 AM
  5. Identifying the first entry
    By HelenP in forum Access
    Replies: 8
    Last Post: 10-20-2010, 08:31 PM

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