Forms

G

Guest

I have created a form using tab control, it also has one subform. When a
record is displayed in the subform I would like my user to be able to double
click that record and goto the second page on the tabbed controls and bring
up another form? IS this possible?
 
G

Guest

Assume your tab control is named tabMyTab
The tabs are indexed with values of 0,1,2,...
(Check the properties page for a tab to see which is which)

Let's assume that yhou want to go tot he 2nd tab (which is by default index
= 1) In the detail section of the continous form, for the double-click event,
put in this:

tabMyTab.Value = 1 ' change to 2nd tab

and away you go.

Now let's take it a bit further - lets say that the 2nd tab has a subform on
it and that you want to filter so you see records associated with a field in
the row you are slecting from page 1. That is, data item 'keyfield' on page
1 is to be used to select all rows that have keyfield's value in column
'somefield'. Try this:

(again, in the DoubleClick event on page 1)

Me.sfrm_Page2.Filter = "[somefield] = " & Me.keyfield
tabMyTab.Value = 1

and you should see only the record(s) you want.

Lastly, if somefield is text, be sure to use quotes in the filter:

Me.sfrm_Page2.Filter = "[somefield] = """ & Me.keyfield & """"
 
M

Mark

May I chime in here? I am looking to do this exact same thing but from
within a query. Same concept. Based on what the viewer sees I would like to
allow them the ability to select that record and go to the source table for
that record. Some kind of button to allow a drill down so to speak within
the datasheet view of the query output. Am I making sense? Thanks

Mark



NKTower said:
Assume your tab control is named tabMyTab
The tabs are indexed with values of 0,1,2,...
(Check the properties page for a tab to see which is which)

Let's assume that yhou want to go tot he 2nd tab (which is by default
index
= 1) In the detail section of the continous form, for the double-click
event,
put in this:

tabMyTab.Value = 1 ' change to 2nd tab

and away you go.

Now let's take it a bit further - lets say that the 2nd tab has a subform
on
it and that you want to filter so you see records associated with a field
in
the row you are slecting from page 1. That is, data item 'keyfield' on
page
1 is to be used to select all rows that have keyfield's value in column
'somefield'. Try this:

(again, in the DoubleClick event on page 1)

Me.sfrm_Page2.Filter = "[somefield] = " & Me.keyfield
tabMyTab.Value = 1

and you should see only the record(s) you want.

Lastly, if somefield is text, be sure to use quotes in the filter:

Me.sfrm_Page2.Filter = "[somefield] = """ & Me.keyfield & """"


Emily said:
I have created a form using tab control, it also has one subform. When a
record is displayed in the subform I would like my user to be able to
double
click that record and goto the second page on the tabbed controls and
bring
up another form? IS this possible?
 
G

Guest

You can't do it with a query per se. But you CAN do it within a form if you
use the 'continuous forms' and you can make the form look very much like a
query/table grid. You may then put either a single button on the form
(header or footer) and have it open the other form/query with just the the
record you want, or you can attach an event to a click or double-click event
on a control in the detail section, or the detail section itself.

Example: suppose the key field is [Product Number] and it is a pure numeric
type (long, integer, etc.) You could do this:

Private Sub Product_Number_Click()
Dim str_WhereClause As String

str_WhereClause = "[Product Number] = " & Me.Product_Number
DoCmd.OpenForm "DetailForm", acNormal, ,str_WhereClause
End Sub

If Product_Number is a text item, then it is slightly different....

Private Sub Product_Number_Click()
Dim str_WhereClause As String

str_WhereClause = "[Product Number] = """ & Me.Product_Number & """"
DoCmd.OpenForm "DetailForm", acNormal, ,str_WhereClause
End Sub


Mark said:
May I chime in here? I am looking to do this exact same thing but from
within a query. Same concept. Based on what the viewer sees I would like to
allow them the ability to select that record and go to the source table for
that record. Some kind of button to allow a drill down so to speak within
the datasheet view of the query output. Am I making sense? Thanks

Mark



NKTower said:
Assume your tab control is named tabMyTab
The tabs are indexed with values of 0,1,2,...
(Check the properties page for a tab to see which is which)

Let's assume that yhou want to go tot he 2nd tab (which is by default
index
= 1) In the detail section of the continous form, for the double-click
event,
put in this:

tabMyTab.Value = 1 ' change to 2nd tab

and away you go.

Now let's take it a bit further - lets say that the 2nd tab has a subform
on
it and that you want to filter so you see records associated with a field
in
the row you are slecting from page 1. That is, data item 'keyfield' on
page
1 is to be used to select all rows that have keyfield's value in column
'somefield'. Try this:

(again, in the DoubleClick event on page 1)

Me.sfrm_Page2.Filter = "[somefield] = " & Me.keyfield
tabMyTab.Value = 1

and you should see only the record(s) you want.

Lastly, if somefield is text, be sure to use quotes in the filter:

Me.sfrm_Page2.Filter = "[somefield] = """ & Me.keyfield & """"


Emily said:
I have created a form using tab control, it also has one subform. When a
record is displayed in the subform I would like my user to be able to
double
click that record and goto the second page on the tabbed controls and
bring
up another form? IS this possible?
 

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