checking values of textbox with table values

  • Thread starter Thread starter kelvin H via AccessMonster.com
  • Start date Start date
K

kelvin H via AccessMonster.com

Hi,

There is a text box in a form that user can enter the value.
How can I check if the value entered by user is already existed in the linked
table or not?
If the value (or record) do not exist, that new value/record will be added to
the record.
If the value do exist, just show the msgbox to indicate.

Thanks
 
Assuming the value to check is text

If DCount("[FieldName]","TableName","[FieldName] = '" & Me.txtValue & "'") =
0 Then
msgbox "Field does not exist"
Else
msgbox "Field already exists"
End If
 
Back
Top