Form Page Filtering

Kapellu2

Registered User.
Local time
Today, 01:43
Joined
Sep 9, 2010
Messages
50
Hey everyone. Right now I am trying to find a way to filter to a specific page on a form upon opening

I have two forms, one for entering information and one for editing the information. When your on the "Search Info" page and you double click a record, that record is opened in the "Edit Info" page. On the edit form there are three pages (or tabs) called Page 1, Page 2, and Page 3. Each of these three pages represent one of three different product types. What I would like to do is have it set up so if the product that is selected in the "Search Info" page is product type 1, Page 1 will be selected on the form. If the product is type 2, page 2 will be selected, ect.

What I was thinking about doing was writing code for the Edit Info page on open that states:

If [Product Type] = Type 1 Then
(Open Page 1)
If [Product Type] = Type 2 Then
(Open Page 2)
If [Product Type] = Type 3 Then
(Open Page 3)

End If

Would code like this work? What should I place in the (Open Page x) lines to tell it to focus on a certain page of the form?

Kinda confusing but I hope I explained this somewhat well.

Thanks for any help in advance,

Sam
 
Code:
Select Case Me![Product Type]
          Case 1
               Me.[B]TabCtl0[/B].Pages(0).SetFocus 'open page 1
          Case 2
               Me.[B]TabCtl0[/B].Pages(1).SetFocus 'open page 2
          Case 3
               Me.[B]TabCtl0[/B].Pages(2).SetFocus 'open page 3
End Select

Replace the TabCtl0 name with the correct name of your Tab Control.
 
Indeed, or hide the other pages:

Code:
Dim i As Integer
For i = 1 to 3
    TabCtl0.Pages(i - 1).Visible = (i = Me![Product Type])
Next i
 

Users who are viewing this thread

Back
Top Bottom