Hi All,
Im trying to finish off some coursework im doing. Ive finished the database, created all my forms and everything works perfectly, that was until i created a switchboard!!!
Im using the following code to notify users that when they enter an artist's name (im building a cd database) a message pops up and tells them the artist is already created and then takes them to the relevant record. It works perfectly if i just open the form, but when i open through the switchboard it bugs out!! Can anyone help? The line in bold is where it errors.
Private Sub Artist_Nme_Befo reUpdate(Cancel As Integer)
Dim ArtistID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClo ne
ArtistID = Me.[Artist Nme].Value
stLinkCriteria = "[Artist Nme]=" & "'" & ArtistID & "'"
'Check Artist table for duplicate Artist Name
If DCount("[Artist Nme]", "Artist", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Artist " _
& ArtistID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to record of original Student Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
Thanks for your help!
Paul
Im trying to finish off some coursework im doing. Ive finished the database, created all my forms and everything works perfectly, that was until i created a switchboard!!!
Im using the following code to notify users that when they enter an artist's name (im building a cd database) a message pops up and tells them the artist is already created and then takes them to the relevant record. It works perfectly if i just open the form, but when i open through the switchboard it bugs out!! Can anyone help? The line in bold is where it errors.
Private Sub Artist_Nme_Befo reUpdate(Cancel As Integer)
Dim ArtistID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClo ne
ArtistID = Me.[Artist Nme].Value
stLinkCriteria = "[Artist Nme]=" & "'" & ArtistID & "'"
'Check Artist table for duplicate Artist Name
If DCount("[Artist Nme]", "Artist", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Artist " _
& ArtistID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to record of original Student Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
Thanks for your help!
Paul
Comment