AdamMVRRS
Registered User.
- Local time
- Today, 17:04
- Joined
- Sep 27, 2013
- Messages
- 16
Hi All,
I'm having a bit of trouble with my database and I was hoping you could help me.
We're a training company so we have a Learner Details form. In this, we have the learners unique National Insurance number (as well as a primary key). When our inputters enter a new learner onto the system, I need a message to pop up and warn them that the National Insurance number has already been entered and I need the option to dismiss that message. The reason for this is that when a learner completes programme they can come back and do a higher level and our subforms etc need a new record to document new reviews etc.
The code I am playing with at the moment is:
Private Sub NI_number_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[NI_number]", "LearnerDetails", "[NI_number] = '" & Me.NI_Number & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate National Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True
Else:
End If
End Sub
(I know the space in the field name is bad - error on my part)
But this code isn't proving much help to me at the moment.
Any help is appreciated! Thanks - Adam
I'm having a bit of trouble with my database and I was hoping you could help me.
We're a training company so we have a Learner Details form. In this, we have the learners unique National Insurance number (as well as a primary key). When our inputters enter a new learner onto the system, I need a message to pop up and warn them that the National Insurance number has already been entered and I need the option to dismiss that message. The reason for this is that when a learner completes programme they can come back and do a higher level and our subforms etc need a new record to document new reviews etc.
The code I am playing with at the moment is:
Private Sub NI_number_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[NI_number]", "LearnerDetails", "[NI_number] = '" & Me.NI_Number & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate National Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True
Else:
End If
End Sub
(I know the space in the field name is bad - error on my part)
But this code isn't proving much help to me at the moment.
Any help is appreciated! Thanks - Adam