Macro to check first instance of a number

  • Thread starter Thread starter colin4255
  • Start date Start date
C

colin4255

Guest
I have a field on a form that we enter a 4 or 6 digit specification number into each time the form is filled in.

What I need is, having entered the number, have access check all the other records in the table that field is form and tell me if the number I have entered is a new one, in other words, if there is no other instance of it in the underlying table/query.

Any simple suggestions. I am no good at writing code.
 
I think you can use this as an after update event.
Code:
dim sSpec as string

sSpec = me.yourfield
if dcount("yourfield","yourtable","yourfield=" & sSpec) = 0 then
msgbox ("this is a new number")
end if

I haven´t tested it though.

Fuga.
 

Users who are viewing this thread

Back
Top Bottom