Multi page tab

G

gorsoft

I am reporting this as my earlier post may not have been too clear.

I have a main form for data entry with too many fields to show on one
screen so have created a tab with 12 pages, one for each for each
product type
selected in a combo box on the first page. After the combo box is
updated, this then shows only the page for the current record's
product type. Each product
type requires only certain fields to be added.

This all works fine but I am trying to cover the situation where the
user selects the wrong product type on the first page but only
realises this after data
for the first page and the related product type page have been
entered. The user then
changes the product type on the main form which reveals a different
product type page but the fields in the original page are still
populated. How can I
clear the unwanted data from just those fields in the second page
after the combo box product type is
changed? For example, is there a way to set the controls on the
"wrong" product type page
to null before the correct page is opened.


Thanks


Gordon
 
G

gorsoft

Yes you can.  Here's a link to a good explanation of working with Tab
controls:

http://bytes.com/topic/access/insights/615446-accessing-tabs-tab-control

Bonniehttp://www.dataplus-svc.com

Thanks for that useful link Bonnie, but my VBA coding skills are
somewhat limited. Using the tab references explained in that article
I can test if the relevant page is visible - what I now need to do is
set all the control values in that page to null. Can you suggest code
that would do that at a stroke or do I have to set each named control
to null in turn? If so, how do I reference a specific control on the
second page from the first page (page 0)?

Thanks

Gordon
 
G

gorsoft

It sounds, from your initial post, that the fields on the tabbed pages are
all from the current record, and have been moved to the tabbed pages for data
entry convience. If this is so, clearing anything accidentally entered can be
done by a simple

Me.Undo

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200911/1

Thanks for the replies, guys. Me.undo won't work because by the time
the user has moved on to the second page, the data on the first page
has been saved. Bonnie, thanks for your code - it does what you say
but the solution does not do what I thought it would. I used the "On
change" event of the product type combo on page 1 to set the focus to
the second page and allow the user to clear the data fields but then
every time a new product is entered, the "On change" event fires again
and causes an error.
Back to the drawing board I think.
 
G

gorsoft

You can put your onchange code inside an if then.

If this then

     do this

End If





It sounds, from your initial post, that the fields on the tabbed pagesare
all from the current record, and have been moved to the tabbed pages for data
[quoted text clipped - 9 lines]
Thanks for the replies, guys. Me.undo won't work because by the time
the user has moved on to the second page, the data on the first page
has been saved.  Bonnie, thanks for your code - it does what you say
but the solution does not do what I thought it would.  I used the "On
change" event of the product type combo on page 1 to set the focus to
the second page and allow the user to clear the data fields but then
every time a new product is entered, the "On change" event fires again
and causes an error.
Back to the drawing board I think.

Of course! I could test for a new record and if so, ignore the "On
change" event. Thanks for following up my problem.

Gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top