Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    DAO recordset field reference syntax

    Below is an attempt to move field contents from a single record within a DAO recordset. The MsgBox is simply confirming correct data content. The two assignment statements that follow the MsgBox confirm that the contents of field "Mov1" and "Mov1t" do in fact exist and can be assigned to corresponding unbound text boxes. However, when I attempt to loop through 16 sets of ordered-pairs I get the error the item not found in collection.



    I'm concluding the expression rsReplicate!Field("Mov" & I) is syntactically incorrect? Yes?


    The code:

    Code:
     
        'Load up the unbound controls from the 16 Movements/Parts and their times
        
        MsgBox rsReplicate!Mov1 & " " & rsReplicate!Mov1t
    
        Me.tbMov1 = rsReplicate!Mov1
        Me.t1 = rsReplicate!Mov1t
        
        For I = 1 To 16
            Me("tbMov" & I) = rsReplicate!Field("Mov" & I)  <<<<<<<<<<<<<<<<< Field reference must be wrong????
            Me("t" & I) = rsReplicate!Field("Mov" & I & "t")
        Next I
    The MsgBox display:
    Click image for larger version. 

Name:	1.jpg 
Views:	5 
Size:	21.6 KB 
ID:	24437

    The error:
    Click image for larger version. 

Name:	2.jpg 
Views:	5 
Size:	18.8 KB 
ID:	24438

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    it is

    rsReplicate.Fields("Mov" & I)

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Lucky guess:
    Code:
        'Load up the unbound controls from the 16 Movements/Parts and their times
            
        For I = 1 To 16
            Me("tbMov" & I) = rsReplicate.Fields("Mov" & I)
            Me("t" & I) = rsReplicate.Fields("Mov" & I & "t")
        Next I

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Ha Ha Ha!! I just posted my "Lucky guess" and then saw your correction. I had "Splat" on the brain.
    Bill

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

Similar Threads

  1. Reference recordset of different form
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 07-09-2013, 10:35 AM
  2. Replies: 3
    Last Post: 05-08-2013, 01:29 PM
  3. Access SQL syntax Reference other tables
    By Lorlai in forum Queries
    Replies: 3
    Last Post: 06-08-2011, 05:21 PM
  4. Wrong reference with .fields in DAO recordset
    By ddd in forum Programming
    Replies: 1
    Last Post: 12-08-2009, 05:34 PM
  5. Syntax-reference to pages
    By AmyHill in forum Access
    Replies: 5
    Last Post: 08-27-2009, 10:04 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