Hi JayStar,
I have successfully added the code and changed the message to suit. But it
only works at the end of the record and then wipes out all the data including
all the correct bits.
True. The solution I proposed only works when you attempt to save the
record. It is not designed to check the record as you are filling it out. To
prevent wiping out the data, try removing (or commenting out) the line of
code that reads: Me.Undo
Also, the message only appears on the last tabbed page.
Not sure what you are telling us here, but the message is designed to work
only in the form(s) that you add this code to. So, it appears as if your last
tabbed page is the one that contains the form with this code.
Is there a way of safely triggering it to pop up when [Age] has been entered
(the last of the 5 fields) and also to then return the focus to the [Date] so
that the record can be amended before going any further.
Yes, but that's going to take a bit of VBA code to write a procedure to
check for duplicates. This procedure would likely need to be called from the
BeforeUpdate event procedure of each of the five text boxes. It would need to
run only if all five text boxes had a value entered. Since I am currently on
my lunch break at work, I don't have the time to go into further details
right now.
By the way, Date is a reserved word in Access. You will be doing yourself a
big favor by avoiding the use of any reserved words for things that you
assign a name to in Access. Here is a handy list compiled by Access MVP Allen
Browne, which I recommend bookmarking for future reference:
Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html
Allen has also made a free utility available that you can download for
checking your databases out for bad field and table names, among other
problems.
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
JayStar said:
Hello again, I did just reply but I got an error message saying it wasn't
sent......
So in the hope this one succeeds.....
I have successfully added the code and changed the message to suit. But it
only works at the end of the record and then wipes out all the data including
all the correct bits. Also, the message only appears on the last tabbed page.
Is there a way of safely triggering it to pop up when [Age] has been entered
(the last of the 5 fields) and also to then return the focus to the [Date] so
that the record can be amended before going any further.
I've tried using "refresh" in the hope it would trigger it, but my message
still only appears on the last tabbed page and all the data is wiped out, so
that didn't work.
I've tried other things to, all with equal failure, Woe ! Your help would
be invaluable to me and to others who are not very IT folk to start with.
Many Many thanks.
John W. Vinson said:
On Sun, 4 Feb 2007 23:09:00 -0800, JayStar
Many thanks, I will try that later today and see how it works. I'll post how
I get on.
Sounds like Tom's got you on the right track; I'll watch this thread
to see if you get it resolved. Thanks Tom, and sorry for butting in!
John W. Vinson [MVP]