In a post from a couple weeks ago, Marion posted this code/message:
Hi there
If you still need help - I usually use apply filter to do what you need.
You need to put an unbound control at the top of your form for a " dummy entry"
Your user enter the ptid in this field then in the after update event of the dummy control you add the code
docmd.applyfilter,"[ptid]=" & me.dummycontrol name
You can fancy this up by using an if statement eg.
x=dcount ("*",Tablename,"[ptid]=" & me.dummy)
if x > then 0 then 'if the record exists
docmd.applyfilter.........
else
docmd.gotorecord acnewrec
realptid.setfous
end if
this uses a count to ascertain if the record exists - if it does it filters it out and if it doesn't it prepares to add a new record.
Hope this helps
...when I tried to use it for this purpose, the "x=..." part at the beginning was highlighted and said "variable undefined" Any clues as to why?
Marion
Hi there
If you still need help - I usually use apply filter to do what you need.
You need to put an unbound control at the top of your form for a " dummy entry"
Your user enter the ptid in this field then in the after update event of the dummy control you add the code
docmd.applyfilter,"[ptid]=" & me.dummycontrol name
You can fancy this up by using an if statement eg.
x=dcount ("*",Tablename,"[ptid]=" & me.dummy)
if x > then 0 then 'if the record exists
docmd.applyfilter.........
else
docmd.gotorecord acnewrec
realptid.setfous
end if
this uses a count to ascertain if the record exists - if it does it filters it out and if it doesn't it prepares to add a new record.
Hope this helps
...when I tried to use it for this purpose, the "x=..." part at the beginning was highlighted and said "variable undefined" Any clues as to why?
Marion