Changing tabs before selecting a record

MarionD

Registered User.
Local time
Today, 18:41
Joined
Oct 10, 2000
Messages
425
Hi all, I'm afraid I'm back with another question!

I have a formular with a tab control on it. ( I hope that is what it's called in English!)

I would like to stop my users changing from one tab to another, without first selecting a record. I'm not sure where to put my code...

I have tried "on change" of the tab control
If isnull(me.id) then
msgbox "Select a record first"
docmd.cancel event
end if

This does show the message, but it still changes to the clicked tab... is there no way to stop the change taking place?

I have tried :
If isnull(me.id) then
msgbox "Select a record first"
me.verstorbene.setfocus ' this is the first page of the tab control
end if

This works but displays the message twice - once on change to a new tab and once again when I put the focus back on the first page.

Is there anyway of saying "if any other page than the first has the focus and the ID is null then display the message, but if the first has the focus dont!)

Thanks



Thanks a lot
Marion
 
Last edited:
I don't think the cancel will work. I would try using the set focus code, but in the change event.
 

Users who are viewing this thread

Back
Top Bottom