Results 1 to 10 of 10
  1. #1
    stylo9 is offline Novice
    Windows 11 Access 2019
    Join Date
    Oct 2023
    Posts
    5

    Question Compile error - procedure too large

    I am getting the subject error "Compile error" - code too large, from a sub.
    but on my other computers it works ok, could it be that I'm using MS office 2019 and on my other computers I'm using 2021?
    code below





    Code:
    Private Sub Report_Open(Cancel As Integer)Dim rst As Recordset
    Dim rst2 As Recordset
    Dim sql As String
    Dim mode As String
    Dim crs As String
    Dim crsbase As String
    Dim dat As Date
    Dim plr As String
    Dim fs As Integer 'front score
    Dim bs As Integer 'back score
    Dim t As Integer 'total score
    
    
    mode = Right(Me.OpenArgs, 7)
    dat = Left(Me.OpenArgs, 11)
    crs = Left(Me.OpenArgs, Len(Me.OpenArgs) - 7)
    crs = Right(crs, Len(crs) - 11)
    
    
    
    
    Select Case mode
        Case Is = "latest0"
            crsbase = crs
        Case Is = "latest1"
            sql = "select * from results where event = #" & Format(dat, "dd mmm yyyy") & "# and left(course,instr(course,' ')-1) = '" & Left(crs, InStr(crs, " ") - 1) & "' order by playerID asc"
            Set rst = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
            crsbase = Left(crs, InStr(1, crs, " ") - 1)
        Case Is = "latest2"
            sql = "select * from results where event = #" & Format(dat, "dd mmm yyyy") & "# and left(course,instr(course,' ')-1) = '" & Left(crs, InStr(crs, " ") - 1) & "' order by playerID asc"
            Set rst = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            crsbase = crs
        Case Is = "latest3"
            sql = "select * from results where event = #" & Format(dat, "dd mmm yyyy") & "# and left(course,instr(course,' ')-1) = '" & Left(crs, InStr(crs, " ") - 1) & "' order by playerID asc"
            Set rst = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            crsbase = crs
        Case Is = "latest4"
            sql = "select * from results where event = #" & Format(dat, "dd mmm yyyy") & "# and left(course,instr(course,' ')-1) = '" & Left(crs, InStr(crs, " ") - 1) & "' order by playerID asc"
            Set rst = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            rst.MoveNext
            crsbase = crs
    End Select
    Me.WSR.Caption = "CR" & vbCrLf & "SLOPE"
    Me.YSR.Caption = "CR" & vbCrLf & "SLOPE"
    Me.BSR.Caption = "CR" & vbCrLf & "SLOPE"
    Me.RSR.Caption = "CR" & vbCrLf & "SLOPE"
    sql = "select * from courses where left(course,instr(1,course,' ')-1) = '" & crsbase & "'"
    Set rst2 = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
    Do Until rst2.EOF
        Select Case (Right(rst2!course, 2))
            Case "MB"
                If IsNull(rst2!D1) = False And rst2!D1 <> "" Then
                    Me.WD1.Caption = rst2!D1
                    Me.WD2.Caption = rst2!D2
                    Me.WD3.Caption = rst2!D3
                    Me.WD4.Caption = rst2!D4
                    Me.WD5.Caption = rst2!D5
                    Me.WD6.Caption = rst2!D6
                    Me.WD7.Caption = rst2!D7
                    Me.WD8.Caption = rst2!D8
                    Me.WD9.Caption = rst2!D9
                    Me.WDF.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.WDO.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.WD10.Caption = rst2!D10
                    Me.WD11.Caption = rst2!D11
                    Me.WD12.Caption = rst2!D12
                    Me.WD13.Caption = rst2!D13
                    Me.WD14.Caption = rst2!D14
                    Me.WD15.Caption = rst2!D15
                    Me.WD16.Caption = rst2!D16
                    Me.WD17.Caption = rst2!D17
                    Me.WD18.Caption = rst2!D18
                    Me.WDB.Caption = rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                    Me.WDT.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9 + rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                End If
                Me.WSR.Caption = "CR " & rst2!course_rating & vbCrLf & "SLOPE " & rst2!course_slope
                Me.GP1.Caption = rst2!P1
                Me.GP2.Caption = rst2!P2
                Me.GP3.Caption = rst2!P3
                Me.GP4.Caption = rst2!P4
                Me.GP5.Caption = rst2!P5
                Me.GP6.Caption = rst2!P6
                Me.GP7.Caption = rst2!P7
                Me.GP8.Caption = rst2!P8
                Me.GP9.Caption = rst2!P9
                Me.GP10.Caption = rst2!P10
                Me.GP11.Caption = rst2!P11
                Me.GP12.Caption = rst2!P12
                Me.GP13.Caption = rst2!P13
                Me.GP14.Caption = rst2!P14
                Me.GP15.Caption = rst2!P15
                Me.GP16.Caption = rst2!P16
                Me.GP17.Caption = rst2!P17
                Me.GP18.Caption = rst2!P18
                Me.GI1.Caption = rst2!I1
                Me.GI2.Caption = rst2!I2
                Me.GI3.Caption = rst2!I3
                Me.GI4.Caption = rst2!I4
                Me.GI5.Caption = rst2!I5
                Me.GI6.Caption = rst2!I6
                Me.GI7.Caption = rst2!I7
                Me.GI8.Caption = rst2!I8
                Me.GI9.Caption = rst2!I9
                Me.GI10.Caption = rst2!I10
                Me.GI11.Caption = rst2!I11
                Me.GI12.Caption = rst2!I12
                Me.GI13.Caption = rst2!I13
                Me.GI14.Caption = rst2!I14
                Me.GI15.Caption = rst2!I15
                Me.GI16.Caption = rst2!I16
                Me.GI17.Caption = rst2!I17
                Me.GI18.Caption = rst2!I18
                Me.LP1.Caption = rst2!P1
                Me.LP2.Caption = rst2!P2
                Me.LP3.Caption = rst2!P3
                Me.LP4.Caption = rst2!P4
                Me.LP5.Caption = rst2!P5
                Me.LP6.Caption = rst2!P6
                Me.LP7.Caption = rst2!P7
                Me.LP8.Caption = rst2!P8
                Me.LP9.Caption = rst2!P9
                Me.LP10.Caption = rst2!P10
                Me.LP11.Caption = rst2!P11
                Me.LP12.Caption = rst2!P12
                Me.LP13.Caption = rst2!P13
                Me.LP14.Caption = rst2!P14
                Me.LP15.Caption = rst2!P15
                Me.LP16.Caption = rst2!P16
                Me.LP17.Caption = rst2!P17
                Me.LP18.Caption = rst2!P18
                Me.LI1.Caption = rst2!I1
                Me.LI2.Caption = rst2!I2
                Me.LI3.Caption = rst2!I3
                Me.LI4.Caption = rst2!I4
                Me.LI5.Caption = rst2!I5
                Me.LI6.Caption = rst2!I6
                Me.LI7.Caption = rst2!I7
                Me.LI8.Caption = rst2!I8
                Me.LI9.Caption = rst2!I9
                Me.LI10.Caption = rst2!I10
                Me.LI11.Caption = rst2!I11
                Me.LI12.Caption = rst2!I12
                Me.LI13.Caption = rst2!I13
                Me.LI14.Caption = rst2!I14
                Me.LI15.Caption = rst2!I15
                Me.LI16.Caption = rst2!I16
                Me.LI17.Caption = rst2!I17
                Me.LI18.Caption = rst2!I18
            Case "MF"
                Me.YSR.Caption = "CR " & rst2!course_rating & vbCrLf & "SLOPE " & rst2!course_slope
                If IsNull(rst2!D1) = False And rst2!D1 <> "" Then
                    Me.YD1.Caption = rst2!D1
                    Me.YD2.Caption = rst2!D2
                    Me.YD3.Caption = rst2!D3
                    Me.YD4.Caption = rst2!D4
                    Me.YD5.Caption = rst2!D5
                    Me.YD6.Caption = rst2!D6
                    Me.YD7.Caption = rst2!D7
                    Me.YD8.Caption = rst2!D8
                    Me.YD9.Caption = rst2!D9
                    Me.YDF.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.YDO.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.YD10.Caption = rst2!D10
                    Me.YD11.Caption = rst2!D11
                    Me.YD12.Caption = rst2!D12
                    Me.YD13.Caption = rst2!D13
                    Me.YD14.Caption = rst2!D14
                    Me.YD15.Caption = rst2!D15
                    Me.YD16.Caption = rst2!D16
                    Me.YD17.Caption = rst2!D17
                    Me.YD18.Caption = rst2!D18
                    Me.YDB.Caption = rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                    Me.YDT.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9 + rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                End If
                Me.GP1.Caption = rst2!P1
                Me.GP2.Caption = rst2!P2
                Me.GP3.Caption = rst2!P3
                Me.GP4.Caption = rst2!P4
                Me.GP5.Caption = rst2!P5
                Me.GP6.Caption = rst2!P6
                Me.GP7.Caption = rst2!P7
                Me.GP8.Caption = rst2!P8
                Me.GP9.Caption = rst2!P9
                Me.GP10.Caption = rst2!P10
                Me.GP11.Caption = rst2!P11
                Me.GP12.Caption = rst2!P12
                Me.GP13.Caption = rst2!P13
                Me.GP14.Caption = rst2!P14
                Me.GP15.Caption = rst2!P15
                Me.GP16.Caption = rst2!P16
                Me.GP17.Caption = rst2!P17
                Me.GP18.Caption = rst2!P18
                Me.GI1.Caption = rst2!I1
                Me.GI2.Caption = rst2!I2
                Me.GI3.Caption = rst2!I3
                Me.GI4.Caption = rst2!I4
                Me.GI5.Caption = rst2!I5
                Me.GI6.Caption = rst2!I6
                Me.GI7.Caption = rst2!I7
                Me.GI8.Caption = rst2!I8
                Me.GI9.Caption = rst2!I9
                Me.GI10.Caption = rst2!I10
                Me.GI11.Caption = rst2!I11
                Me.GI12.Caption = rst2!I12
                Me.GI13.Caption = rst2!I13
                Me.GI14.Caption = rst2!I14
                Me.GI15.Caption = rst2!I15
                Me.GI16.Caption = rst2!I16
                Me.GI17.Caption = rst2!I17
                Me.GI18.Caption = rst2!I18
                Me.LP1.Caption = rst2!P1
                Me.LP2.Caption = rst2!P2
                Me.LP3.Caption = rst2!P3
                Me.LP4.Caption = rst2!P4
                Me.LP5.Caption = rst2!P5
                Me.LP6.Caption = rst2!P6
                Me.LP7.Caption = rst2!P7
                Me.LP8.Caption = rst2!P8
                Me.LP9.Caption = rst2!P9
                Me.LP10.Caption = rst2!P10
                Me.LP11.Caption = rst2!P11
                Me.LP12.Caption = rst2!P12
                Me.LP13.Caption = rst2!P13
                Me.LP14.Caption = rst2!P14
                Me.LP15.Caption = rst2!P15
                Me.LP16.Caption = rst2!P16
                Me.LP17.Caption = rst2!P17
                Me.LP18.Caption = rst2!P18
                Me.LI1.Caption = rst2!I1
                Me.LI2.Caption = rst2!I2
                Me.LI3.Caption = rst2!I3
                Me.LI4.Caption = rst2!I4
                Me.LI5.Caption = rst2!I5
                Me.LI6.Caption = rst2!I6
                Me.LI7.Caption = rst2!I7
                Me.LI8.Caption = rst2!I8
                Me.LI9.Caption = rst2!I9
                Me.LI10.Caption = rst2!I10
                Me.LI11.Caption = rst2!I11
                Me.LI12.Caption = rst2!I12
                Me.LI13.Caption = rst2!I13
                Me.LI14.Caption = rst2!I14
                Me.LI15.Caption = rst2!I15
                Me.LI16.Caption = rst2!I16
                Me.LI17.Caption = rst2!I17
                Me.LI18.Caption = rst2!I18
            Case "LB"
                If IsNull(rst2!D1) = False And rst2!D1 <> "" Then
                    Me.BD1.Caption = rst2!D1
                    Me.BD2.Caption = rst2!D2
                    Me.BD3.Caption = rst2!D3
                    Me.BD4.Caption = rst2!D4
                    Me.BD5.Caption = rst2!D5
                    Me.BD6.Caption = rst2!D6
                    Me.BD7.Caption = rst2!D7
                    Me.BD8.Caption = rst2!D8
                    Me.BD9.Caption = rst2!D9
                    Me.BDF.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.BDO.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.BD10.Caption = rst2!D10
                    Me.BD11.Caption = rst2!D11
                    Me.BD12.Caption = rst2!D12
                    Me.BD13.Caption = rst2!D13
                    Me.BD14.Caption = rst2!D14
                    Me.BD15.Caption = rst2!D15
                    Me.BD16.Caption = rst2!D16
                    Me.BD17.Caption = rst2!D17
                    Me.BD18.Caption = rst2!D18
                    Me.BDB.Caption = rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                    Me.BDT.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9 + rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                End If
                Me.BSR.Caption = "CR " & rst2!course_rating & vbCrLf & "SLOPE " & rst2!course_slope
                Me.LP1.Caption = rst2!P1
                Me.LP2.Caption = rst2!P2
                Me.LP3.Caption = rst2!P3
                Me.LP4.Caption = rst2!P4
                Me.LP5.Caption = rst2!P5
                Me.LP6.Caption = rst2!P6
                Me.LP7.Caption = rst2!P7
                Me.LP8.Caption = rst2!P8
                Me.LP9.Caption = rst2!P9
                Me.LP10.Caption = rst2!P10
                Me.LP11.Caption = rst2!P11
                Me.LP12.Caption = rst2!P12
                Me.LP13.Caption = rst2!P13
                Me.LP14.Caption = rst2!P14
                Me.LP15.Caption = rst2!P15
                Me.LP16.Caption = rst2!P16
                Me.LP17.Caption = rst2!P17
                Me.LP18.Caption = rst2!P18
                Me.LI1.Caption = rst2!I1
                Me.LI2.Caption = rst2!I2
                Me.LI3.Caption = rst2!I3
                Me.LI4.Caption = rst2!I4
                Me.LI5.Caption = rst2!I5
                Me.LI6.Caption = rst2!I6
                Me.LI7.Caption = rst2!I7
                Me.LI8.Caption = rst2!I8
                Me.LI9.Caption = rst2!I9
                Me.LI10.Caption = rst2!I10
                Me.LI11.Caption = rst2!I11
                Me.LI12.Caption = rst2!I12
                Me.LI13.Caption = rst2!I13
                Me.LI14.Caption = rst2!I14
                Me.LI15.Caption = rst2!I15
                Me.LI16.Caption = rst2!I16
                Me.LI17.Caption = rst2!I17
                Me.LI18.Caption = rst2!I18
                Me.GP1.Caption = rst2!P1
                Me.GP2.Caption = rst2!P2
                Me.GP3.Caption = rst2!P3
                Me.GP4.Caption = rst2!P4
                Me.GP5.Caption = rst2!P5
                Me.GP6.Caption = rst2!P6
                Me.GP7.Caption = rst2!P7
                Me.GP8.Caption = rst2!P8
                Me.GP9.Caption = rst2!P9
                Me.GP10.Caption = rst2!P10
                Me.GP11.Caption = rst2!P11
                Me.GP12.Caption = rst2!P12
                Me.GP13.Caption = rst2!P13
                Me.GP14.Caption = rst2!P14
                Me.GP15.Caption = rst2!P15
                Me.GP16.Caption = rst2!P16
                Me.GP17.Caption = rst2!P17
                Me.GP18.Caption = rst2!P18
                Me.GI1.Caption = rst2!I1
                Me.GI2.Caption = rst2!I2
                Me.GI3.Caption = rst2!I3
                Me.GI4.Caption = rst2!I4
                Me.GI5.Caption = rst2!I5
                Me.GI6.Caption = rst2!I6
                Me.GI7.Caption = rst2!I7
                Me.GI8.Caption = rst2!I8
                Me.GI9.Caption = rst2!I9
                Me.GI10.Caption = rst2!I10
                Me.GI11.Caption = rst2!I11
                Me.GI12.Caption = rst2!I12
                Me.GI13.Caption = rst2!I13
                Me.GI14.Caption = rst2!I14
                Me.GI15.Caption = rst2!I15
                Me.GI16.Caption = rst2!I16
                Me.GI17.Caption = rst2!I17
                Me.GI18.Caption = rst2!I18
            Case "LF"
                If IsNull(rst2!D1) = False And rst2!D1 <> "" Then
                    Me.RD1.Caption = rst2!D1
                    Me.RD2.Caption = rst2!D2
                    Me.RD3.Caption = rst2!D3
                    Me.RD4.Caption = rst2!D4
                    Me.RD5.Caption = rst2!D5
                    Me.RD6.Caption = rst2!D6
                    Me.RD7.Caption = rst2!D7
                    Me.RD8.Caption = rst2!D8
                    Me.RD9.Caption = rst2!D9
                    Me.RDF.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.RDO.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9
                    Me.RD10.Caption = rst2!D10
                    Me.RD11.Caption = rst2!D11
                    Me.RD12.Caption = rst2!D12
                    Me.RD13.Caption = rst2!D13
                    Me.RD14.Caption = rst2!D14
                    Me.RD15.Caption = rst2!D15
                    Me.RD16.Caption = rst2!D16
                    Me.RD17.Caption = rst2!D17
                    Me.RD18.Caption = rst2!D18
                    Me.RDB.Caption = rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                    Me.RDT.Caption = rst2!D1 + rst2!D2 + rst2!D3 + rst2!D4 + rst2!D5 + rst2!D6 + rst2!D7 + rst2!D8 + rst2!D9 + rst2!D10 + rst2!D11 + rst2!D12 + rst2!D13 + rst2!D14 + rst2!D15 + rst2!D16 + rst2!D17 + rst2!D18
                End If
                Me.RSR.Caption = "CR " & rst2!course_rating & vbCrLf & "SLOPE " & rst2!course_slope
                Me.LP1.Caption = rst2!P1
                Me.LP2.Caption = rst2!P2
                Me.LP3.Caption = rst2!P3
                Me.LP4.Caption = rst2!P4
                Me.LP5.Caption = rst2!P5
                Me.LP6.Caption = rst2!P6
                Me.LP7.Caption = rst2!P7
                Me.LP8.Caption = rst2!P8
                Me.LP9.Caption = rst2!P9
                Me.LP10.Caption = rst2!P10
                Me.LP11.Caption = rst2!P11
                Me.LP12.Caption = rst2!P12
                Me.LP13.Caption = rst2!P13
                Me.LP14.Caption = rst2!P14
                Me.LP15.Caption = rst2!P15
                Me.LP16.Caption = rst2!P16
                Me.LP17.Caption = rst2!P17
                Me.LP18.Caption = rst2!P18
                Me.LI1.Caption = rst2!I1
                Me.LI2.Caption = rst2!I2
                Me.LI3.Caption = rst2!I3
                Me.LI4.Caption = rst2!I4
                Me.LI5.Caption = rst2!I5
                Me.LI6.Caption = rst2!I6
                Me.LI7.Caption = rst2!I7
                Me.LI8.Caption = rst2!I8
                Me.LI9.Caption = rst2!I9
                Me.LI10.Caption = rst2!I10
                Me.LI11.Caption = rst2!I11
                Me.LI12.Caption = rst2!I12
                Me.LI13.Caption = rst2!I13
                Me.LI14.Caption = rst2!I14
                Me.LI15.Caption = rst2!I15
                Me.LI16.Caption = rst2!I16
                Me.LI17.Caption = rst2!I17
                Me.LI18.Caption = rst2!I18
                Me.GP1.Caption = rst2!P1
                Me.GP2.Caption = rst2!P2
                Me.GP3.Caption = rst2!P3
                Me.GP4.Caption = rst2!P4
                Me.GP5.Caption = rst2!P5
                Me.GP6.Caption = rst2!P6
                Me.GP7.Caption = rst2!P7
                Me.GP8.Caption = rst2!P8
                Me.GP9.Caption = rst2!P9
                Me.GP10.Caption = rst2!P10
                Me.GP11.Caption = rst2!P11
                Me.GP12.Caption = rst2!P12
                Me.GP13.Caption = rst2!P13
                Me.GP14.Caption = rst2!P14
                Me.GP15.Caption = rst2!P15
                Me.GP16.Caption = rst2!P16
                Me.GP17.Caption = rst2!P17
                Me.GP18.Caption = rst2!P18
                Me.GI1.Caption = rst2!I1
                Me.GI2.Caption = rst2!I2
                Me.GI3.Caption = rst2!I3
                Me.GI4.Caption = rst2!I4
                Me.GI5.Caption = rst2!I5
                Me.GI6.Caption = rst2!I6
                Me.GI7.Caption = rst2!I7
                Me.GI8.Caption = rst2!I8
                Me.GI9.Caption = rst2!I9
                Me.GI10.Caption = rst2!I10
                Me.GI11.Caption = rst2!I11
                Me.GI12.Caption = rst2!I12
                Me.GI13.Caption = rst2!I13
                Me.GI14.Caption = rst2!I14
                Me.GI15.Caption = rst2!I15
                Me.GI16.Caption = rst2!I16
                Me.GI17.Caption = rst2!I17
                Me.GI18.Caption = rst2!I18
        End Select
        rst2.MoveNext
    Loop
    
    
    Me.competition.Caption = "COMPETITION COURSE  " & crsbase
    If Not (mode = "latest0") Then
        Me.Event.Caption = "DATE: " & Format(rst!Event, "dd mmm yyyy")
        Me.PlrA.Caption = "PLR A: " & rst!PlayerID
        Me.PlrAHcp.Caption = rst!Handicap
        Me.PlrAStrokes.Caption = rst!Playing_hcp
        Me.A1.Caption = rst!S1
        Me.A2.Caption = rst!S2
        Me.A3.Caption = rst!S3
        Me.A4.Caption = rst!S4
        Me.A5.Caption = rst!S5
        Me.A6.Caption = rst!S6
        Me.A7.Caption = rst!S7
        Me.A8.Caption = rst!S8
        Me.A9.Caption = rst!S9
        Me.A10.Caption = rst!S10
        Me.A11.Caption = rst!S11
        Me.A12.Caption = rst!S12
        Me.A13.Caption = rst!S13
        Me.A14.Caption = rst!S14
        Me.A15.Caption = rst!S15
        Me.A16.Caption = rst!S16
        Me.A17.Caption = rst!S17
        Me.A18.Caption = rst!S18
        fs = CorrectScores(rst!S1, rst!Playing_hcp, rst!Par1, rst!I1) + CorrectScores(rst!S2, rst!Playing_hcp, rst!Par2, rst!I2) + CorrectScores(rst!S3, rst!Playing_hcp, rst!Par3, rst!I3) + CorrectScores(rst!S4, rst!Playing_hcp, rst!Par4, rst!I4) + CorrectScores(rst!S5, rst!Playing_hcp, rst!Par5, rst!I5) + CorrectScores(rst!S6, rst!Playing_hcp, rst!Par6, rst!I6) + CorrectScores(rst!S7, rst!Playing_hcp, rst!Par7, rst!I7) + CorrectScores(rst!S8, rst!Playing_hcp, rst!Par8, rst!I8) + CorrectScores(rst!S9, rst!Playing_hcp, rst!Par9, rst!I9)
        Me.AF.Caption = fs
        bs = CorrectScores(rst!S10, rst!Playing_hcp, rst!Par10, rst!I10) + CorrectScores(rst!S11, rst!Playing_hcp, rst!Par11, rst!I11) + CorrectScores(rst!S12, rst!Playing_hcp, rst!Par12, rst!I12) + CorrectScores(rst!S13, rst!Playing_hcp, rst!Par13, rst!I13) + CorrectScores(rst!S14, rst!Playing_hcp, rst!Par14, rst!I14) + CorrectScores(rst!S15, rst!Playing_hcp, rst!Par15, rst!I15) + CorrectScores(rst!S16, rst!Playing_hcp, rst!Par16, rst!I16) + CorrectScores(rst!S17, rst!Playing_hcp, rst!Par17, rst!I17) + CorrectScores(rst!S18, rst!Playing_hcp, rst!Par18, rst!I18)
        Me.AB.Caption = bs
        Me.AO.Caption = Me.AF.Caption
        Me.AT.Caption = rst!Gross
        Me.APts.Caption = rst!TotalPoints
        rst.MoveNext
        If Not (rst.EOF) Then
            'Me.Event.Caption = Format(rst!Event, "dd mmm yyyy")
            Me.PlrB.Caption = "PLR B: " & rst!PlayerID
            Me.PlrBHcp.Caption = rst!Handicap
            Me.PlrBStrokes.Caption = rst!Playing_hcp
            Me.B1.Caption = rst!S1
            Me.B2.Caption = rst!S2
            Me.B3.Caption = rst!S3
            Me.B4.Caption = rst!S4
            Me.B5.Caption = rst!S5
            Me.B6.Caption = rst!S6
            Me.B7.Caption = rst!S7
            Me.B8.Caption = rst!S8
            Me.B9.Caption = rst!S9
            Me.B10.Caption = rst!S10
            Me.B11.Caption = rst!S11
            Me.B12.Caption = rst!S12
            Me.B13.Caption = rst!S13
            Me.B14.Caption = rst!S14
            Me.B15.Caption = rst!S15
            Me.B16.Caption = rst!S16
            Me.B17.Caption = rst!S17
            Me.B18.Caption = rst!S18
            fs = CorrectScores(rst!S1, rst!Playing_hcp, rst!Par1, rst!I1) + CorrectScores(rst!S2, rst!Playing_hcp, rst!Par2, rst!I2) + CorrectScores(rst!S3, rst!Playing_hcp, rst!Par3, rst!I3) + CorrectScores(rst!S4, rst!Playing_hcp, rst!Par4, rst!I4) + CorrectScores(rst!S5, rst!Playing_hcp, rst!Par5, rst!I5) + CorrectScores(rst!S6, rst!Playing_hcp, rst!Par6, rst!I6) + CorrectScores(rst!S7, rst!Playing_hcp, rst!Par7, rst!I7) + CorrectScores(rst!S8, rst!Playing_hcp, rst!Par8, rst!I8) + CorrectScores(rst!S9, rst!Playing_hcp, rst!Par9, rst!I9)
            Me.BF.Caption = fs
            bs = CorrectScores(rst!S10, rst!Playing_hcp, rst!Par10, rst!I10) + CorrectScores(rst!S11, rst!Playing_hcp, rst!Par11, rst!I11) + CorrectScores(rst!S12, rst!Playing_hcp, rst!Par12, rst!I12) + CorrectScores(rst!S13, rst!Playing_hcp, rst!Par13, rst!I13) + CorrectScores(rst!S14, rst!Playing_hcp, rst!Par14, rst!I14) + CorrectScores(rst!S15, rst!Playing_hcp, rst!Par15, rst!I15) + CorrectScores(rst!S16, rst!Playing_hcp, rst!Par16, rst!I16) + CorrectScores(rst!S17, rst!Playing_hcp, rst!Par17, rst!I17) + CorrectScores(rst!S18, rst!Playing_hcp, rst!Par18, rst!I18)
            Me.BB.Caption = bs
            Me.BO.Caption = Me.BF.Caption
            Me.BT.Caption = rst!Gross
            Me.BPts.Caption = rst!TotalPoints
            rst.MoveNext
        End If
        If Not (rst.EOF) Then
            Me.PlrC.Caption = "PLR C: " & rst!PlayerID
            Me.PlrCHcp.Caption = rst!Handicap
            Me.PlrCStrokes.Caption = rst!Playing_hcp
            Me.C1.Caption = rst!S1
            Me.C2.Caption = rst!S2
            Me.C3.Caption = rst!S3
            Me.C4.Caption = rst!S4
            Me.C5.Caption = rst!S5
            Me.C6.Caption = rst!S6
            Me.C7.Caption = rst!S7
            Me.C8.Caption = rst!S8
            Me.C9.Caption = rst!S9
            Me.C10.Caption = rst!S10
            Me.C11.Caption = rst!S11
            Me.C12.Caption = rst!S12
            Me.C13.Caption = rst!S13
            Me.C14.Caption = rst!S14
            Me.C15.Caption = rst!S15
            Me.C16.Caption = rst!S16
            Me.C17.Caption = rst!S17
            Me.C18.Caption = rst!S18
            fs = CorrectScores(rst!S1, rst!Playing_hcp, rst!Par1, rst!I1) + CorrectScores(rst!S2, rst!Playing_hcp, rst!Par2, rst!I2) + CorrectScores(rst!S3, rst!Playing_hcp, rst!Par3, rst!I3) + CorrectScores(rst!S4, rst!Playing_hcp, rst!Par4, rst!I4) + CorrectScores(rst!S5, rst!Playing_hcp, rst!Par5, rst!I5) + CorrectScores(rst!S6, rst!Playing_hcp, rst!Par6, rst!I6) + CorrectScores(rst!S7, rst!Playing_hcp, rst!Par7, rst!I7) + CorrectScores(rst!S8, rst!Playing_hcp, rst!Par8, rst!I8) + CorrectScores(rst!S9, rst!Playing_hcp, rst!Par9, rst!I9)
            Me.CF.Caption = fs
            bs = CorrectScores(rst!S10, rst!Playing_hcp, rst!Par10, rst!I10) + CorrectScores(rst!S11, rst!Playing_hcp, rst!Par11, rst!I11) + CorrectScores(rst!S12, rst!Playing_hcp, rst!Par12, rst!I12) + CorrectScores(rst!S13, rst!Playing_hcp, rst!Par13, rst!I13) + CorrectScores(rst!S14, rst!Playing_hcp, rst!Par14, rst!I14) + CorrectScores(rst!S15, rst!Playing_hcp, rst!Par15, rst!I15) + CorrectScores(rst!S16, rst!Playing_hcp, rst!Par16, rst!I16) + CorrectScores(rst!S17, rst!Playing_hcp, rst!Par17, rst!I17) + CorrectScores(rst!S18, rst!Playing_hcp, rst!Par18, rst!I18)
            Me.CB.Caption = bs
            Me.CO.Caption = Me.CF.Caption
            Me.CT.Caption = rst!Gross
            Me.CPts.Caption = rst!TotalPoints
            rst.MoveNext
        End If
        If Not (rst.EOF) Then
            Me.Mkr.Caption = "MKR: " & rst!PlayerID
            Me.MkrHcp.Caption = rst!Handicap
            Me.MkrStrokes.Caption = rst!Playing_hcp
            Me.Mkr1.Caption = rst!S1
            Me.Mkr2.Caption = rst!S2
            Me.Mkr3.Caption = rst!S3
            Me.Mkr4.Caption = rst!S4
            Me.Mkr5.Caption = rst!S5
            Me.Mkr6.Caption = rst!S6
            Me.Mkr7.Caption = rst!S7
            Me.Mkr8.Caption = rst!S8
            Me.Mkr9.Caption = rst!S9
            Me.Mkr10.Caption = rst!S10
            Me.Mkr11.Caption = rst!S11
            Me.Mkr12.Caption = rst!S12
            Me.Mkr13.Caption = rst!S13
            Me.Mkr14.Caption = rst!S14
            Me.Mkr15.Caption = rst!S15
            Me.Mkr16.Caption = rst!S16
            Me.Mkr17.Caption = rst!S17
            Me.Mkr18.Caption = rst!S18
            fs = CorrectScores(rst!S1, rst!Playing_hcp, rst!Par1, rst!I1) + CorrectScores(rst!S2, rst!Playing_hcp, rst!Par2, rst!I2) + CorrectScores(rst!S3, rst!Playing_hcp, rst!Par3, rst!I3) + CorrectScores(rst!S4, rst!Playing_hcp, rst!Par4, rst!I4) + CorrectScores(rst!S5, rst!Playing_hcp, rst!Par5, rst!I5) + CorrectScores(rst!S6, rst!Playing_hcp, rst!Par6, rst!I6) + CorrectScores(rst!S7, rst!Playing_hcp, rst!Par7, rst!I7) + CorrectScores(rst!S8, rst!Playing_hcp, rst!Par8, rst!I8) + CorrectScores(rst!S9, rst!Playing_hcp, rst!Par9, rst!I9)
            Me.MkrF.Caption = fs
            bs = CorrectScores(rst!S10, rst!Playing_hcp, rst!Par10, rst!I10) + CorrectScores(rst!S11, rst!Playing_hcp, rst!Par11, rst!I11) + CorrectScores(rst!S12, rst!Playing_hcp, rst!Par12, rst!I12) + CorrectScores(rst!S13, rst!Playing_hcp, rst!Par13, rst!I13) + CorrectScores(rst!S14, rst!Playing_hcp, rst!Par14, rst!I14) + CorrectScores(rst!S15, rst!Playing_hcp, rst!Par15, rst!I15) + CorrectScores(rst!S16, rst!Playing_hcp, rst!Par16, rst!I16) + CorrectScores(rst!S17, rst!Playing_hcp, rst!Par17, rst!I17) + CorrectScores(rst!S18, rst!Playing_hcp, rst!Par18, rst!I18)
            Me.MkrB.Caption = bs
            Me.MkrO.Caption = Me.MkrF.Caption
            Me.MkrT.Caption = rst!Gross
            Me.MkrPts.Caption = rst!TotalPoints
            rst.MoveNext
        End If
    End If
    
    
    End Sub

  2. #2
    stylo9 is offline Novice
    Windows 11 Access 2019
    Join Date
    Oct 2023
    Posts
    5
    Update!
    I installed MS Office 2021 on this PC and I'm still getting the same result so it's something to do with the PC or compiler
    Please help
    thanks

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    The simple answer is break it up into smaller procedures.

    Perhaps a little explanation of what your trying to accomplish. There may be a more efficient way.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    stylo9 is offline Novice
    Windows 11 Access 2019
    Join Date
    Oct 2023
    Posts
    5
    Moke123
    I understand the workaround but it shouldn't be necessary as it works perfectly well on my other pc using win 11 and office 2021 and on my laptop using win 10 and office 2021
    Maybe someone else has encountered this anomaly and has a fix.
    thanks anyway

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Ever thought of a Google?

    https://www.google.com/search?q=vba+...hrome&ie=UTF-8

    One of the links mentions difference in bitness?
    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. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Looks to me you could probably eliminate half that code or more if you looped some of those procedures.

    Code:
    For i = 1 to 18
    me.Controls("LP" & i).Caption = ...
    rs.MoveNext
    next i
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    stylo9 is offline Novice
    Windows 11 Access 2019
    Join Date
    Oct 2023
    Posts
    5
    Once again, it's not really about reducing the code it's about why it should trigger that compiler error on one computer and not on another computer, the dbase is exactly the same for both computers using the same O.S. and the path is the same and the version of MS Office is the same.

  8. #8
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Are they both 64bit or both 32-bit versions of office?
    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 ↓↓

  9. #9
    stylo9 is offline Novice
    Windows 11 Access 2019
    Join Date
    Oct 2023
    Posts
    5
    All 64bit versions of office
    Ok will do
    Thanks

  10. #10
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Quote Originally Posted by stylo9 View Post
    All 64bit versions of office
    And it compiles correctly on all the machines except that one?
    If it does I would suspect possibly corruption on the copy on the new machine?

    Try a fresh copy of it from a working machine.
    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 ↓↓

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

Similar Threads

  1. Replies: 7
    Last Post: 10-27-2021, 08:42 AM
  2. Exporting to Excel, Procedure Too Large
    By asmores in forum Access
    Replies: 2
    Last Post: 03-08-2015, 11:05 AM
  3. Replies: 10
    Last Post: 09-08-2014, 06:07 PM
  4. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  5. Replies: 7
    Last Post: 06-08-2012, 09:55 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