Results 1 to 3 of 3
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question Begin:/Endit:

    What/how is the above used? I inherited some code that has that in it and I've never seen it before. It is used with a loop. See code below



    Code:
    DAO.DBEngine.SetOption dbMaxLocksPerFile, 40000
     
        Set RS = db.OpenRecordset("QryCCUAssignOpen", DB_OPEN_DYNASET)
        Set rs1 = db.OpenRecordset("QryCCUEmp", DB_OPEN_DYNASET)
    '    Set rs2 = db.OpenRecordset("QryCCUAssignOther", DB_OPEN_DYNASET)
    '    Set rs3 = db.OpenRecordset("QryCCUAssignDefaults", DB_OPEN_DYNASET)
        RS.MoveFirst
        rs1.MoveFirst
      HoldName = RS!RACF_No
      updateName = rs1!RACF_No
      i = 1
    Begin:
     
        RS.Edit
        RS!RACF_No = updateName
        RS.Update
        RS.MoveNext
     
      If RS.EOF Then GoTo Endit
     
      If i < [Forms]![FrmProcess]![TxtAvg] Then
        i = i + 1
     
        GoTo Begin
     
        End If
     
      If i > [Forms]![FrmProcess]![TxtAvg] Then
     
       rs1.MoveNext
     
         updateName = rs1!RACF_No
         HoldName = "99999999"
         i = 1
     
      GoTo Begin
    End If
     
    Endit:

  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,521
    It's just control-of-flow code. These lines direct code execution to those points:

    If RS.EOF Then GoTo Endit

    GoTo Begin

    The technique is generally frowned upon, as it leads to what's often called "spaghetti code", ie it wanders around aimlessly. It does have it's place though, like any other tool. You just shouldn't over use it. In this case, a loop could probably have substituted for them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Thanks for the explanation. My follow-up question was going to be could a loop be used in its place.

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

Tags for this Thread

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