Private Sub YC_TAG_BeforeUpdate(Cancel As Integer)
If DCount("YC_TAG", "Asset Details", _
"YC_TAG = " & Me.YC_TAG [COLOR=red]<--- this syntax will only work if the [B][U]YC_TAG[/U][/B] is [U]not[/U] a text data type.[/COLOR]) = 0 Then
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Else
If MsgBox("This asset already exists in the database. " & _
"Would you like to edit that record?", vbExclamation + vbYesNo) = vbYes Then
me.filter = "YC_TAG = " me.YC_TAG [COLOR=red]<---filters are kind of annoying sometimes.[/COLOR]
[COLOR=red] You can use [B][U]docmd.searchforrecord[/U][/B] and [/COLOR]
[COLOR=red] jump to it with that method instead of filtering if you want.[/COLOR]
Me.FilterOn = True [COLOR=red]<--- if you do as above, you don't have to mess with this line either. :)[/COLOR]
End If
End If
End Sub
End Sub [COLOR=red]<--- one too many subs here![/COLOR]