P
paul
I check for duplicates in the entry of organisationname
using the following code:
Private Sub OrganisationName_BeforeUpdate(Cancel As
Integer)
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim Response As Integer
On Error GoTo ErrorHandler
If (Me![OrganisationName] <> Me!
[OrganisationName].OldValue) Or IsNull(Me!
[OrganisationName].OldValue) Then
cnn.Open CurrentProject.Connection
rst.Open "SELECT * FROM pritblOrganisation WHERE
[OrganisationName] = " & Chr(34) & Me!OrganisationName &
Chr(34), cnn, adOpenForwardOnly
If Not rst.EOF Then
Response = MsgBox("A Record Already Exists for
this Organisation!" & Chr$(10) & Chr$(13) & "Do You Want
to Cancel the Entry?", 20, "Duplicate Organisation Name")
If Response = vbYes Then
Me.Undo
End If
End If
rst.Close
cnn.Close
End If
'End If
GoTo Done
ErrorHandler:
MsgBox Err.Description
Done:
End Sub
This works fine, but when I add a share-level password to
the database, open it and check whether this code works,
I get a message "Invalid Password" instead of the
expected mesaage of "Duplicate Organisation Name". I
could forget the share-level security password, but the
database requires restricted access. Any suggestions?
using the following code:
Private Sub OrganisationName_BeforeUpdate(Cancel As
Integer)
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim Response As Integer
On Error GoTo ErrorHandler
If (Me![OrganisationName] <> Me!
[OrganisationName].OldValue) Or IsNull(Me!
[OrganisationName].OldValue) Then
cnn.Open CurrentProject.Connection
rst.Open "SELECT * FROM pritblOrganisation WHERE
[OrganisationName] = " & Chr(34) & Me!OrganisationName &
Chr(34), cnn, adOpenForwardOnly
If Not rst.EOF Then
Response = MsgBox("A Record Already Exists for
this Organisation!" & Chr$(10) & Chr$(13) & "Do You Want
to Cancel the Entry?", 20, "Duplicate Organisation Name")
If Response = vbYes Then
Me.Undo
End If
End If
rst.Close
cnn.Close
End If
'End If
GoTo Done
ErrorHandler:
MsgBox Err.Description
Done:
End Sub
This works fine, but when I add a share-level password to
the database, open it and check whether this code works,
I get a message "Invalid Password" instead of the
expected mesaage of "Duplicate Organisation Name". I
could forget the share-level security password, but the
database requires restricted access. Any suggestions?