Event for subform

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
J

Jonathan Blitz

I have a form that is displayed in Datasheet format.
It contains a subform that is also displayed in Datasheet format.
I need to capture the event when the subform is open (by clicking on the '+'
on the higher level).

I have used the FormOpen event but it doesn't work. It only fires on the
first opening of a subform.
If I open the subform of another row on the main form the event foesn't
fire.

What event should I be using?

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Hi Jonathan,

You can try subform's current event (Form_Current); when you click the '+'
sign, the event will be fired (it is because it highlights the first row of
the subform automatically).

Please feel free to reply to the threads if you have any concerns or
questions.



Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Jonathan Blitz" <[email protected]>
| Subject: Event for subform
| X-Tomcat-NG: microsoft.public.access.forms
|
| I have a form that is displayed in Datasheet format.
| It contains a subform that is also displayed in Datasheet format.
| I need to capture the event when the subform is open (by clicking on the
'+'
| on the higher level).
|
| I have used the FormOpen event but it doesn't work. It only fires on the
| first opening of a subform.
| If I open the subform of another row on the main form the event foesn't
| fire.
|
| What event should I be using?
|
| --
| Jonathan Blitz
| AnyKey Limited
| Israel
|
| "When things seem bad
| Don't worry and shout
| Just count up the times
| Things have worked themselves out."
|
|
|
 
Suddenly it seems to work but only sometimes.

The problem seems to be that in order for the value to be transfered from
the parent to the subform (in datasheet mode) I have to actually select the
parent row.
If I just click on the plus sign and then refer to the connecting value (or
to parent.field) I get the value of the currently selected row in the parent
and not that of the parent of this subform.\

Is this possible or am I going mad? :)

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Hi Jonathan,

It seems you work on a project, and the subform is connected to the main
form programmatically? I am not quite clear of the question, would you
please post more information?

1. If you dynamically connect the subform to main form, how do you connect
them?

2. It seems you want to transfer the data from main form to the subform?

3. When you click on the '+' on the higher level, what do you want to be
executed by code?



Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Jonathan Blitz" <[email protected]>

|
| The problem seems to be that in order for the value to be transfered from
| the parent to the subform (in datasheet mode) I have to actually select
the
| parent row.
| If I just click on the plus sign and then refer to the connecting value
(or
| to parent.field) I get the value of the currently selected row in the
parent
| and not that of the parent of this subform.\
|
| Is this possible or am I going mad? :)
|
| --
| Jonathan Blitz
| AnyKey Limited
| Israel
|
| "When things seem bad
| Don't worry and shout
| Just count up the times
| Things have worked themselves out."
| | > Hi Jonathan,
| >
| > You can try subform's current event (Form_Current); when you click the
'+'
| > sign, the event will be fired (it is because it highlights the first row
| of
| > the subform automatically).
| >
| > Please feel free to reply to the threads if you have any concerns or
| > questions.
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Product Support Services
| > Microsoft Corporation
| > Get Secure! - <www.microsoft.com/security>
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Jonathan Blitz" <[email protected]>
| > | Subject: Event for subform
| > | X-Tomcat-NG: microsoft.public.access.forms
| > |
| > | I have a form that is displayed in Datasheet format.
| > | It contains a subform that is also displayed in Datasheet format.
| > | I need to capture the event when the subform is open (by clicking on
the
| > '+'
| > | on the higher level).
| > |
| > | I have used the FormOpen event but it doesn't work. It only fires on
the
| > | first opening of a subform.
| > | If I open the subform of another row on the main form the event
foesn't
| > | fire.
| > |
| > | What event should I be using?
| > |
| > | --
| > | Jonathan Blitz
| > | AnyKey Limited
| > | Israel
| > |
| > | "When things seem bad
| > | Don't worry and shout
| > | Just count up the times
| > | Things have worked themselves out."
| > |
| > |
| > |
| >
|
|
|
 
What I have is a parent with a subform.
When I click on the '+' I need to cpture the event as I have to make changes
to the Data Source according to certain criteria. This is not a problem. I
can catch the event. However, for each row in the parent it is caught only
once. This is also survivable.

My problem is that when I try to refer to the link field of the parent from
within the child I get the wrong value.
It seems that clicking on the '+' does not select that record so when I
refer to parent.keyfield I get the row that is highlighted in the parent and
not the one I clicked on.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Hi Jonathan,

We can use RecordSet's FindFirst method to find the current expanding
subdatasheet parent (the clicking one) and set focus to it. For example, in
the subform's current event, run the following code will

Private Sub Form_Current()

Dim varRec As DAO.Recordset

Set varRec = Me.Parent.RecordsetClone

If Me!mid <> Me.Parent!mid Then
varRec.FindFirst "mid = '" & Me.mid & "'"

Me.Parent.Bookmark = varRec.Bookmark

End If

Set varRec = Nothing

End Sub

Please feel free to reply to the thread if you have any concern or question.


Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Jonathan Blitz" <[email protected]>
| X-Tomcat-NG: microsoft.public.access.forms
|
| What I have is a parent with a subform.
| When I click on the '+' I need to cpture the event as I have to make
changes
| to the Data Source according to certain criteria. This is not a problem. I
| can catch the event. However, for each row in the parent it is caught only
| once. This is also survivable.
|
| My problem is that when I try to refer to the link field of the parent
from
| within the child I get the wrong value.
| It seems that clicking on the '+' does not select that record so when I
| refer to parent.keyfield I get the row that is highlighted in the parent
and
| not the one I clicked on.
|
| --
| Jonathan Blitz
| AnyKey Limited
| Israel
|
| "When things seem bad
| Don't worry and shout
| Just count up the times
| Things have worked themselves out."
| | > Hi Jonathan,
| >
| > It seems you work on a project, and the subform is connected to the main
| > form programmatically? I am not quite clear of the question, would you
| > please post more information?
| >
| > 1. If you dynamically connect the subform to main form, how do you
connect
| > them?
| >
| > 2. It seems you want to transfer the data from main form to the subform?
| >
| > 3. When you click on the '+' on the higher level, what do you want to be
| > executed by code?
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Product Support Services
| > Microsoft Corporation
| > Get Secure! - <www.microsoft.com/security>
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > --------------------
| > | From: "Jonathan Blitz" <[email protected]>
| >
| > |
| > | The problem seems to be that in order for the value to be transfered
| from
| > | the parent to the subform (in datasheet mode) I have to actually
select
| > the
| > | parent row.
| > | If I just click on the plus sign and then refer to the connecting
value
| > (or
| > | to parent.field) I get the value of the currently selected row in the
| > parent
| > | and not that of the parent of this subform.\
| > |
| > | Is this possible or am I going mad? :)
| > |
| > | --
| > | Jonathan Blitz
| > | AnyKey Limited
| > | Israel
| > |
| > | "When things seem bad
| > | Don't worry and shout
| > | Just count up the times
| > | Things have worked themselves out."
| > | | > | > Hi Jonathan,
| > | >
| > | > You can try subform's current event (Form_Current); when you click
the
| > '+'
| > | > sign, the event will be fired (it is because it highlights the first
| row
| > | of
| > | > the subform automatically).
| > | >
| > | > Please feel free to reply to the threads if you have any concerns or
| > | > questions.
| > | >
| > | >
| > | >
| > | > Sincerely,
| > | >
| > | > Alick Ye, MCSD
| > | > Product Support Services
| > | > Microsoft Corporation
| > | > Get Secure! - <www.microsoft.com/security>
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | >
| > | > --------------------
| > | > | From: "Jonathan Blitz" <[email protected]>
| > | > | Subject: Event for subform
| > | > | X-Tomcat-NG: microsoft.public.access.forms
| > | > |
| > | > | I have a form that is displayed in Datasheet format.
| > | > | It contains a subform that is also displayed in Datasheet format.
| > | > | I need to capture the event when the subform is open (by clicking
on
| > the
| > | > '+'
| > | > | on the higher level).
| > | > |
| > | > | I have used the FormOpen event but it doesn't work. It only fires
on
| > the
| > | > | first opening of a subform.
| > | > | If I open the subform of another row on the main form the event
| > foesn't
| > | > | fire.
| > | > |
| > | > | What event should I be using?
| > | > |
| > | > | --
| > | > | Jonathan Blitz
| > | > | AnyKey Limited
| > | > | Israel
| > | > |
| > | > | "When things seem bad
| > | > | Don't worry and shout
| > | > | Just count up the times
| > | > | Things have worked themselves out."
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Back
Top