Results 1 to 6 of 6
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    placement of .movefirst and .movenext

    i have this code

    Code:
    Option Compare Database
    
    Private Sub Form_Load()
    With Me.Recordset
    
    
    Do Until Me.ID = 24855
    
    
    .MoveNext
    
    
    If txtBonusID = "CJW" Then
    txtBonusID = "3"
    
    
    ElseIf txtBonusID = "lpc" Then
    txtBonusID = "5"
    
    
    ElseIf txtBonusID = "ke" Then
    txtBonusID = "4"
    
    
    ElseIf txtBonusID = "els" Then
    txtBonusID = "8"
    
    
    ElseIf txtBonusID = "ra" Then
    txtBonusID = "1"
    
    
    ElseIf txtBonusID = "wp" Then
    txtBonusID = "7"
    
    
    ElseIf txtBonusID = "wsp" Then
    txtBonusID = "7"
    
    
    ElseIf txtBonusID = "akb" Then
    txtBonusID = "2"
    
    
    ElseIf txtBonusID = "ss" Then
    txtBonusID = "6"
    
    
    End If
    
    
    
    
    Loop
    End With
    End Sub
    However it doesn't start from the first record in the query - it skips the first and does the next so I know I have the placement of .movenext - I would love to know where to put it and where to place .movefirst so that it starts at the first record and then flows through the IF with each record with .movenext

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    The MoveNext should be right before Loop.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by pbaldy View Post
    The MoveNext should be right before Loop.
    duh me, of course!

    I am planning on getting a brain transplant today... should fix things.

    Thanks pbaldy!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Ruegen View Post

    ...I am planning on getting a brain transplant today... should fix things...
    Perhaps removing those things from your ears might help!

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Missinglinq View Post
    Perhaps removing those things from your ears might help!
    lol

    I tried, oh how I tried...

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

Similar Threads

  1. .MOVEFIRST ADO Object not working
    By togo in forum Access
    Replies: 8
    Last Post: 10-05-2012, 02:35 PM
  2. access 2007 vba .movenext
    By jtmedin in forum Programming
    Replies: 9
    Last Post: 06-13-2011, 10:02 PM
  3. Placement of fields within Report Question
    By batowl in forum Reports
    Replies: 1
    Last Post: 03-18-2011, 08:49 AM
  4. rs.FindNext vs. rs.MoveNext
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 02-04-2011, 03:13 PM
  5. MsgBox Placement
    By tpcervelo in forum Programming
    Replies: 2
    Last Post: 12-27-2010, 07:36 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