Hi guys. Sorry for re-open this thread but there's a new unexpected problem going on. With the code that seemed to work well:
Code:
SQL = "FROM Anagrafica_docenti INNER JOIN (Anagrafica_materie INNER JOIN (Anagrafica_corsi INNER JOIN Anagrafica_art_corsi ON Anagrafica_corsi.ID_Anagrafica_corsi = Anagrafica_art_corsi.CORSO) ON Anagrafica_materie.ID_anagmaterie = Anagrafica_art_corsi.MATERIA) ON Anagrafica_docenti.ID_Anagrafica_docenti = Anagrafica_art_corsi.ID_Anagrafica_docenti" & _"ORDER BY Anagrafica_art_corsi.DATA_CONTRATTO DESC , Anagrafica_art_corsi.PROTOCOLLO DESC;
Set Recordset = CurrentDb.OpenRecordset("Select * from sqlbookmark WHERE ID_Anagrafica_docenti=" & Me.ID_Anagrafica_docenti & " AND Data_contratto=#" & DMax("Data_contratto", "sqlbookmark", "ID_Anagrafica_docenti=" & Me.ID_Anagrafica_docenti) & "#")
it happens that some contract dates (DATA_CONTRATTO) result as "null", even if I typed them in.
For instance, for the lecturer X, if I put dates from 26th March to 31th March, the automation populates the word model without any problem. With older or more recent dates, it stops at the DATA_CONTRATTO with the message: "invalid use of Null". But the field is not null!
Is there any limitation that I can't see in the code that sets the recordset?
Thank you.