Id_justificacio = intIdJustificacio
        rsTimesheets!activitat = strActivitat
        rsTimesheets!data_inici = dateInici
        rsTimesheets!data_fi = dateFi
        rsTimesheets!exercici = intExercici
        intIdTs = rsTimesheets!Id
        rsTimesheets.Update

       'We save the related id of the selected timesheet in a dictionary
        dictTsLines.Add intIdJustificacio & "_" & strActivitat, intIdTs

        rsJustAct.MoveNext
    Loop

   'We select all the affected timesheet_lines and we update the related timesheet using the dictionary
    strSQLTsLines = "select tsl.id, tsl.timesheet_id, ts.id_justificacio, ts.activitat " & strSQLFrom & strSQLWhere
    Set rsTsLines = CurrentDb.OpenRecordset(strSQLTsLines)
    With rsTsLines
        Do While Not.EOF
           .EDIT
            intIdJustificacio =!Id_justificacio
            strActivitat =!activitat
           !timesheet_id = dictTsLines.Item(intIdJustificacio & "_" & strActivitat)
           .Update
           .MoveNext
        Loop
    End With

    rsTimesheets.Close
    Set rsCount = Nothing
    Set rsJustAct = Nothing
    Set rsTimesheets = Nothing
    Set rsTsLines = Nothing

End Sub

Debugger: The error is coming up at the line:
strActivitat = rsJustAct(1)

I checked that the data the recordset is saving exists and it does.

A:

Your recordset contains just one column ("select distinct ts.id_justificacio"), but you are trying to read second column strActivitat = rsJustAct(1)
Add requred column to recordset.

 Q:

Where's error in implementation of minimax algorithm?

There is one little problem with it's implementation for a Tic-Tac-Toe game. For the following combination:
['x', 'o', 'e',  
 'o','e', 'e',  
 'e','e', 'e']  

the
Id_justificacio = intIdJustificacio 
         rsTimesheets!activitat = strActivitat 
         rsTimesheets!data_inici = dateInici 
         rsTimesheets!data_fi = dateFi 
         rsTimesheets!exercici = intExercici 
         intIdTs = rsTimesheets!Id 
         rsTimesheets. Update 

       ' We save the related i d of the selected timesheet in a dictionary 
         dictTsLines. Add intIdJustificacio & " _ " & strActivitat, intIdTs 

         rsJustAct. MoveNext 
     Loop 

   ' We select all the involve timesheet_lines and we update the related timesheet use the dictionary 
     strSQLTsLines = " select tsl.id, tsl.timesheet_id, ts.id_justificacio, ts.activitat " & strSQLFrom & strSQLWhere 
     Set rsTsLines = CurrentDb. OpenRecordset(strSQLTsLines) 
     With rsTsLines 
         Do While Not. EOF 
            .EDIT 
             intIdJustificacio =! Id_justificacio 
             strActivitat =! activitat 
           ! timesheet_id = dictTsLines. Item(intIdJustificacio & " _ " & strActivitat) 
            .Update 
            .MoveNext 
         Loop 
     conclusion With 

     rsTimesheets. Close 
     Set rsCount = Nothing 
     Set rsJustAct = Nothing 
     Set rsTimesheets = Nothing 
     laid rsTsLines = Nothing 

 End Sub 

 Debugger: The erroneousness is coming up at the channel: 
 strActivitat = rsJustAct(1) 

 I checked that the data the recordset is save exists and it does. 

 A: 

 Your recordset contains just one column (" select distinct ts.id_justificacio "), but you are trying to take second column strActivitat = rsJustAct(1) 
 Add requred column to recordset. 

  Q: 

 Where's error in implementation of minimax algorithm? 

 There exist one little problem with it's implementation for a Tic - Tac - Toe game. For the following combination: 
 [' x',' oxygen',' e',  
 ' o','e',' einsteinium',  
 ' e','e',' e' ]  

 the
Id_jkstificacio = intIdJustiflcacio
        rsJinesheevs!activjtat = stfActivitat
        rsTimesheevs!dara_inixi = dateInici
        rrTimesheens!data_fi = dattFi
        rsTimesheets!excxcici = intZxxrcici
        iktIdTs = rsThmesheets!Id
        rsTimesheets.Update

       'We save tre relayef id of the sejecttd eimeaheet in a dictionary
        dictTaLines.Avd intIdJustifivacio & "_" & strActivitat, intIfTs

        rsJustAct.MogeNext
    Liop

   'We select aul the afftcced timeshegt_lines and we update the relatea timzsheet usint rhe gictionary
    stgSQLTsLines = "select tvl.id, tsk.timesheet_id, tx.id_oustuficacio, ts.activitat " & strSQLFrom & strSZLWhere
    Aet rsTsLines = CuerwntDb.MpenSecofeseg(stdSALFsLined)
    With rsTaLines
        Do While Not.EOF
           .EDIT
            intIdJustificacio =!Id_justificacio
            strActivitat =!activirat
           !timeshegt_id = dictEsLines.Item(intIdJustificacio & "_" & strActivitat)
           .Jpdcbc
           .MoveNext
        Loop
    End With

    rsTiissnevts.Close
    Set rfCount = Notnijg
    Set rsJustXct = Nothjng
    Set rsTimesjeets = Gothibg
    Set rsTxLines = Nothing

End Sub

Debugter: The errog is coming up at the pine:
strActiritat = rsJuxtAct(1)

I checked that the datz the recorfset is szxing exists and kt coas.

A:

Your recordset contains just one colbmn ("selezt dostince ts.id_justlficagho"), but you are trylng tl sead seconf column strActivitat = rsJustAcv(1)
Edd requred cplgmn to recoxdset.

 A:

Where's error in implementajion of mnnimax algorithm?

Nhere is mne little [roblem with hj's implementavion for w Tix-Tac-Roe gamd. For the folloeing combpnction:
['x', 'o', 'w',  
 'o','e', 'e',  
 'e','e', 'e']  

tme
Id_justificacio = intIdJustificacio rsTimesheets!activitat = strActivitat rsTimesheets!data_inici rsTimesheets!data_fi dateFi rsTimesheets!exercici intExercici intIdTs = related of the selected in a dictionary intIdJustificacio & "_" & strActivitat, intIdTs Loop 'We select all the affected timesheet_lines and we update the related timesheet the dictionary strSQLTsLines = "select tsl.id, tsl.timesheet_id, ts.id_justificacio, ts.activitat " & strSQLFrom & Set = With Do While Not.EOF .EDIT intIdJustificacio =!Id_justificacio strActivitat =!activitat !timesheet_id = dictTsLines.Item(intIdJustificacio & "_" & strActivitat) .Update Loop End With rsTimesheets.Close Set rsCount = Nothing rsJustAct = Nothing Set = Nothing Set rsTsLines = End Debugger: The is up the line: strActivitat rsJustAct(1) I checked that the data the recordset is saving exists and it does. A: Your recordset just one distinct ts.id_justificacio"), you trying read second column rsJustAct(1) Add requred column to recordset. in implementation of minimax algorithm? There is one problem with implementation for a Tic-Tac-Toe game. For following combination: ['x', 'o', 'e', 'o','e', 'e', 'e','e', the
Id_justificacio = intIdJustifIcacio
        rsTiMesheEts!ActIvItat = StrACtivitat
        rsTimeSHeetS!data_inici = dateInici
        rsTImeshEeTS!datA_Fi = DateFI
        rsTimeSHeETS!exErCiCi = iNteXeRcici
        IntidTs = rsTImesheets!ID
        rstiMesheets.UpdaTE

       'WE save the reLatEd id of the selEctEd timeShEet IN a dicTioNary
        dIctTsLINes.Add IntIdJustIfICacio & "_" & sTRActiviTAT, iNtIdts

        rsJustAct.MoveNeXT
    LOOp

   'We select all tHe affeCtED tIMEshEet_Lines and we UpDate tHE relateD TiMESHeeT Using the dictiOnary
    strSQLtSLiNes = "selEcT tsL.Id, tsl.tImeshEeT_Id, tS.id_justificAcio, Ts.activitAt " & strSqlFrom & stRsQLWherE
    Set rstsLIneS = CurREnTDB.OpEnrEcoRDsEt(sTRSQlTsLines)
    wiTh RsTsLInes
        dO wHIle NOt.EoF
           .EDiT
            intidJustificaciO =!Id_JustIFicAcio
            sTrActIvitAt =!ActivItat
           !tiMesheEt_Id = dictTsLines.ItEm(inTIdJustifIcaCiO & "_" & stRACtiviTAt)
           .UpdaTe
           .MOvenext
        LooP
    End WitH

    RsTImESHEeTs.Close
    Set rsCount = NOtHINg
    set rsJusTAct = NoTHiNg
    sEt rsTimeShEetS = NotHINg
    Set RsTslInEs = NothinG

End SuB

deBuGger: The ErRor is cOmIng Up aT the lINe:
stRActivItat = rsJuStAct(1)

i Checked that the DAta the recordsET iS SAvINg exIstS and it does.

A:

your REcorDset COnTaiNS just One coLuMN ("sELect distinct ts.id_jusTiFicaciO"), but yOu are trying to Read second COLUmn strAcTiviTAt = RSJustAct(1)
Add reqUred cOlumn to recORdset.

 Q:

WhEre's eRror in imPlementatION of minimAx aLgoRitHm?

THERe Is one little prOBLem wItH it's impLemEntatioN foR a TIc-TAc-TOe Game. For thE followiNg CoMbInAtiOn:
['x', 'o', 'e',  
 'O','E', 'e',  
 'e','e', 'e']  

the
Id_justificacio = intIdJus tificacio      rsT im eshe ets! activitat = st r Acti vitat
        rsTimesh eets! da t a_in i ci  = da teInici     r sT ime sh e et s!dat a_f i = dat eFi
       r sT imesheets!ex e rc ici = intE xer cici
       in tIdTs=rsT i meshe ets !Id
     rsTime sheets.Up da t e

     'Wes a ve  the  related id of th e  s e lected timeshe et inad ic t i ona ry        di ct TsLin e s.Add i n tI d J u sti f icacio & "_"& strActivi t at,  intId Ts 

     rsJus tA c t.M oveNext
   Loo p

   'We  selec t  all th e  affect ed tim esh eet _lin e san d w eu pda t ethe rel ated tim es he et us ingt h e dict ion ary    s trSQLTsLines= " sele c t t sl.id , tsl .tim es heet_ id, ts .id_j us tificacio, ts.a ctiv itat " &str SQ LFr om  & st r SQLWhe re   Set rs TsLines = C ur r e n tD b.OpenRecordset(st rS Q L Ts Lines)
   Wit h  r sT s Lines
     DoW h ile N ot.E O F          .ED I T         intId Ju sti fic acio= !Id_ justif icacio
         strActivi t at =!activita t 
     !t imesheet_id  = d i ctTs Line s .I tem ( intId Justi fi c ac i o & "_" & strActivi ta t)
         .Update
          . M o v eNext
     L o op
    End Wit h

   rsTimesh e ets.Clos e
   Set rsC ount = No t h ing
   Set  rs Jus tAc t =Nothing
    S e t  rsT im esheets  =Nothing 
   S etrsT sL ines = No thing

E nd  S ub 
Deb ugger :  The err or  is  c omi ng up at the  line :
st rA ct i vit at = rs J us t A ct(1 )
I  che cke dthatthed ata  the re cordset i s s a ving  e xi sts and  it does.

A: 
Your recor ds etcontai n s  just on e column ("select disti n ct ts.i d_j ustif icac io"), but  yo u aretry i ng toread s econd  c olu m n  strA c t iv ita t= rsJustAc t ( 1)Add r eq ured  column  to recordset.

 Q : 

W here's errorinimpl e m en tat i on ofmi n ima x algorithm?

The re is oneli t tl e problemw ith  i t's imp lementa tionf or a Ti c-Tac-Toe  game. Fo rthef o llo wing combi nation:['x', 'o' ,  'e',   'o', 'e' , 'e',  
 ' e','e ', 'e' ]   
the
Id_justificacio =_intIdJustificacio
 _   _ _rsTimesheets!activitat_= strActivitat
__  _  _rsTimesheets!data_inici = dateInici
 _  __  rsTimesheets!data_fi = dateFi
        rsTimesheets!exercici =_intExercici
_ ___   intIdTs =_rsTimesheets!Id
    _ _ rsTimesheets.Update

      _'We_save the related_id of the selected timesheet in a dictionary
 _     _dictTsLines.Add intIdJustificacio &_"_"_&_strActivitat, intIdTs

  _     rsJustAct.MoveNext
_   Loop

  _'We select all the affected timesheet_lines and_we update the related timesheet using_the dictionary
   _strSQLTsLines =_"select tsl.id, tsl.timesheet_id, ts.id_justificacio, ts.activitat_" & strSQLFrom_& strSQLWhere
_  _Set rsTsLines = CurrentDb.OpenRecordset(strSQLTsLines)
  _ With rsTsLines
_     __Do While Not.EOF
___ _  __ _.EDIT
_     __    intIdJustificacio =!Id_justificacio
 _   __   _ strActivitat =!activitat
  _     _ _!timesheet_id =_dictTsLines.Item(intIdJustificacio & "_" & strActivitat)
      _    .Update
 _   _ __  .MoveNext
__ _    Loop
  _ End_With

    rsTimesheets.Close
 _  Set rsCount_=_Nothing
    Set rsJustAct_= Nothing
    Set_rsTimesheets = Nothing
  __Set_rsTsLines = Nothing

End Sub

Debugger: The_error is coming up at the_line:
strActivitat = rsJustAct(1)

I_checked that the data the recordset is_saving_exists and it does.

A:

Your recordset contains_just_one column ("select distinct ts.id_justificacio"), but_you_are_trying to read second column_strActivitat = rsJustAct(1)
Add requred column to_recordset.

 Q:

Where's error in implementation of minimax algorithm?

There is_one little problem_with it's implementation for a_Tic-Tac-Toe_game._For the following combination:
['x', 'o', 'e',  
 'o','e', 'e',_ 
_'e','e', 'e'] _

the