Io insisto nella mia idea.
Io devo inserire anche libri presi da utenti che non sono già inseriti nella tabella Utenti.

Ho scritto questo codice per l'evento "Dopo aggiornamento" nel campo Utente della maschera di immissione dati per la tabella Libri.
Purtroppo la MsgBox "Utente già inserito" mi compare anche per utenti che non sono nella tabella Utenti.
Qualcuno sa dirmi perché?


Option Compare Database

Private Sub Utente_AfterUpdate()

Dim dbs As Database
Dim tab_Libri As Recordset
Dim tab_Utenti As Recordset
Dim CampoUtenteLibri As Field
Dim CampoUtenteUtenti As Field
Dim UtenteRicercato As Variant
Dim UtenteDaConfrontare As Variant

Set dbs = OpenDatabase("C:\Documents and Settings\Nathan Gori\Documenti\Database\Libri e Utenti 2002.mdb")

Set tab_Libri = dbs.OpenRecordset("Libri")
Set tab_Utenti = dbs.OpenRecordset("Utenti")

Set CampoUtenteLibri = tab_Libri.Fields("Utente")
Set CampoUtenteUtenti = tab_Utenti.Fields("Utente")


UtenteRicercato = CampoUtenteLibri.Value



While (Not tab_Utenti.EOF)
UtenteDaConfrontare = CampoUtenteUtenti.Value
If UtenteRicercato = UtenteDaConfrontare Then
MsgBox "Utente già inserito"
End
Else
tab_Utenti.MoveNext
End If
Wend




End Sub