Descecrator
Registered User.
- Local time
- Today, 18:22
- Joined
- Oct 18, 2005
- Messages
- 11
Hi People,
I have a form where the user can add records to the database. But when a textbox is filled, I tried the BeforeUpdate, but it doesn't work with the dLookUp. The "Tpon" is a string that has to be unique for every record in the table "Tekst". The code:
Private Sub Tpon_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("[Tpon]", "Tekst", "[Tpon] = " & [Forms]![TekstenToevoegen]![Tpon])) Then
MsgBox ("Wijzig de bestandsnaam, deze bestaat al!"), vbOKOnly
[Forms]![TekstenToevoegen]![Tpon].SetFocus
End If
End Sub
The tablename is "Tekst", The formname is "TekstenToevoegen" and the field on the form is "Tpon" en the field in the table is also "Tpon". The form adds records to the table tekst.
Plz help me. Thnx in advance.
Greetz
I have a form where the user can add records to the database. But when a textbox is filled, I tried the BeforeUpdate, but it doesn't work with the dLookUp. The "Tpon" is a string that has to be unique for every record in the table "Tekst". The code:
Private Sub Tpon_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("[Tpon]", "Tekst", "[Tpon] = " & [Forms]![TekstenToevoegen]![Tpon])) Then
MsgBox ("Wijzig de bestandsnaam, deze bestaat al!"), vbOKOnly
[Forms]![TekstenToevoegen]![Tpon].SetFocus
End If
End Sub
The tablename is "Tekst", The formname is "TekstenToevoegen" and the field on the form is "Tpon" en the field in the table is also "Tpon". The form adds records to the table tekst.
Plz help me. Thnx in advance.
Greetz