Hi, I am trying to search the records in a table "air to see if there is a match with general.HN (a field in the current form). If there is I want to do nothing, else add a new record with general.HN. I just cant seem to get it right though! any help appreciated!Cheers Tania
Set db = CurrentDb()
Set rs = db.OpenRecordset("air", dbOpenDynaset)
If Not rs.EOF then
If rs![HN] = Me![general.HN] Then
Else
rs.AddNew
rs![HN] = Me![general_info.HN]
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End If
End If
Set db = CurrentDb()
Set rs = db.OpenRecordset("air", dbOpenDynaset)
If Not rs.EOF then
If rs![HN] = Me![general.HN] Then
Else
rs.AddNew
rs![HN] = Me![general_info.HN]
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End If
End If