How much code is too much.. (1 Viewer)

Rich_Lovina

Registered User.
Local time
Tomorrow, 04:36
Joined
Feb 27, 2002
Messages
225
My Data Input Form has 3 events on one Combobox. One function checks for an existing entry of the same record based on 3 fields, of which this Combobox is the last.

Where would I put and what type of function would I use to allow the user to go to the same record, which is responding to:
"That full name and Deptcode already exists"
thus enabling a user to update this first entry of a (potentially) duplicate record?
The function needs to operate on the "OK" command in the MsgBox, or in a separate button, I guess.

Here are the combo's existing codes:

1.
Private Sub Combo143_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("[Inits]", "GOVDOUG", "[Inits]= '" & Me![Inits] & "' And [Surname] = '" & Me![Surname] & "' And [DeptCode] = '" & Me![Deptcode] & "'")) Then
Beep
MsgBox "That full name and Deptcode already exists"
End If
Deptcode_Exit:
Exit Sub
Deptcode_Err:
MsgBox Error$
Resume Deptcode_Exit
End Sub

2. (Irrelevant to Question)
Private Sub Combo143_AfterUpdate()
Me.[Combo143] = StrConv(Me.[Combo143], vbUpperCase)
If Not IsNull(Me.Combo143) Then
Me.Combo143.DefaultValue = "='" & Me.Combo143 & "'"
Else
Me.Combo143.TabStop = True
End If

End Sub

3. (Irrelevant to Question)
Private Sub Combo143_NotInList(NewData As String, Response As Integer)
Response = AddToSource("DEPT228", "DEPT_ID", NewData)

End Sub

Thanks any guidance on this
 

Users who are viewing this thread

Top Bottom