Double Click from One Tab form to the next

  • Thread starter Thread starter Sami
  • Start date Start date
S

Sami

I have a main form with four tabs. The fist tab contains a form that allows
the user to enter search criteria and upon clicking the Search button the
form footer shows the results of the search. I would like the user to be
able to double click on the case number (primary key for table) from the form
footer for their choice and have it automatically go to the next tab
(MasterInfoSubform) which contains the information for the record from the
same table. I have searched the discussion group and tried several things,
but can't seem to get right. ANY help would be GREATLY appreciated.

Thanks,
 
You could use the tabindex value for that.

when doubleclicking you can set the tabindex as follows:

me.tabctl.tabindex=me.tabctl.tabindex+1
me.tabctl.pages(tabindex).setfocus

which will make it go to the next tab

with that in mind you could add a couple more lines to place a filter on the
form which is on the second subform.

forms!frmsubformname.filter="your id field here"
forms!frmsubformname.filteron=true

maybe two pointers to get you started.
 
Probably should mention I'm pretty green at this VBA coding. I put the
following in the double click event for the form footer...

Me.TabCtlCaseLog.TabIndex = Me.TabCtlCaseLog.TabIndex + 1
Me.TabCtlCaseLog.Pages(TabIndex).SetFocus

And I get the error message Method or Data Member Not Found.
 
Sami,

Try the following:

In the doubleclick of the formfooter place the following code:

me.parent.tabctlCaselog.pages(tabindex + 1).setfocus

that should do the trick. The me.parent has to be placed first because the
form is actually on the tabs and we should set the reference to the tab
first. But with the line above the focus should be set to the second tab. If
you want to set it to another tab just relace the +1 with the appropriate
number.

hth
 
Maurice,

Thanks so much for trying to help me, I really appreciate it.

When I tried this code I got the following error message:

Application-defined or object-defined error

I have been working on this one problem for two weeks and as of yesterday
(before I got your response) I had nixed the idea and created the search form
as a main form that then opens the subform with tabs and got it the double
click to work that way. I backed the database up and was able to try your
suggestion with the old setup and got the above error. If you have any other
suggestions, please let me know, I will continue to move forward the
"cheaters" way (using the main form opening the subform) so that I least I
feel like I am making some progress.

Thanks again,

Sami
 
Hi Sami,

You are right in progressing with the database using another technique work
has to go on right :-)

Here's what i tried to mimic your situation, let's see if i did correctly
and can provide you with some needed assistance on this one.

I created a form an put a tabcontrol on that (two pages).
I created a subform and placed that on the first tab. On the subform i added
a formfooter and put the code on the formfooter_doubleclick event to go to
tabpage two. This worked as expected.

To make things easier for a test try the following;

Create a empty form with a tabcontrol on it (leave all the defaults)
When done you should have a form with a tabcontrol on it (probably "tabctl0"
or something like that).
Now place a button on the form and behind the click_event of the button
place the following code:

me.tabctl0.pages(0).setfocus

this will make the focus go to the first tab. Now when you want to go to the
specified second page replace the zero with a 1. This will set the focus to
the second page.

Assuming the data is always on the second page this will solve the issue
with the error you are getting.

So try this first and let me know if this works for you and we will proceed
from that point on.
 
Hi Maurice,

I am going to try this tomorrow (if things go better) had connectivity
issues all day and haven't had an opportunity to try this.

I will let you know, and again, THANK YOU!

Sami
 
Back
Top