May 3, 2009 at 3:12 pm
I have an ADP connected with a database in SQL Server 2005 Developer Edition database server
when I enter Duplicate records from the ADP forms to the unique fields in the Sql server database tables, It does not allow me, but does not give me any error messages from Sql server also when I delete any related records from my ADP, It does not delete, but does not give me any error or information messages
I mean how can I see sql server notifications or information from my ADP by message boxes.
May 4, 2009 at 5:26 pm
Try to check for your duplicate prior to adding the record.
In the BeforeUpdate event in the text box of your possible duplicate field try something like this:
Private Sub txtYourFieldName_BeforeUpdate(Cancel As Integer)
Dim varResult As Variant
varResult = DLookup("FieldSource", "RecordTable", "[FieldSource] ='" & Me!FieldSource & "'")
If varResult = Me![FieldSource] Then
MsgBox "This FieldSource Number has already been entered." & vbCrLf & _
"ReEnter the Fieldsource Number.", vbOKOnly, "Duplicate FieldSource Number"
Cancel = True
'Me!FieldSource= Null
Me!txtFieldSource.Undo
End If
End Sub
"When in danger or in doubt. Run in circles, scream and shout!" TANSTAAFL
"Robert A. Heinlein"
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply