Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: Access 2007 - Recordsource & Subform

Geek News

Access 2007 - Recordsource & Subform
Charles Tam 11/26/2008 1:30:05 AM
Hi Everyone,

While converting our apps from Access 2003 to 2007, I've come across the
following issue. We've a main Form which contains a Subform. In Access
2007, when we update the main Form's recordsource value, the subform re-opens
(i.e. its on open event is executed) However, this doesn't happen in Access
2003. Does anyone has a workaround?

Re: Access 2007 - Recordsource & Subform
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 11/26/2008 2:04:29 AM
On Tue, 25 Nov 2008 17:30:05 -0800, Charles Tam
<CharlesTam[ at ]discussions.microsoft.com> wrote:

Why are you changing the RecordSource?

I can't reproduce this behavior with the Northwind "Order Details"
form. Can you?

-Tom.
Microsoft Access MVP


[Quoted Text]
>Hi Everyone,
>
>While converting our apps from Access 2003 to 2007, I've come across the
>following issue. We've a main Form which contains a Subform. In Access
>2007, when we update the main Form's recordsource value, the subform re-opens
>(i.e. its on open event is executed) However, this doesn't happen in Access
>2003. Does anyone has a workaround?
Re: Access 2007 - Recordsource & Subform
Charles Tam 11/26/2008 3:09:01 AM
Hi Tom,
We change the main Form's recordsource, so that, the returning data could be
determined at runtime. E.g. we would return specific records insteads of all
records. In regards to Northwind "Order Details", unfortunately, we're not
using the "Link Master/Child Fields", i.e. our subform is unbounded.


"Tom van Stiphout" wrote:

[Quoted Text]
> On Tue, 25 Nov 2008 17:30:05 -0800, Charles Tam
> <CharlesTam[ at ]discussions.microsoft.com> wrote:
>
> Why are you changing the RecordSource?
>
> I can't reproduce this behavior with the Northwind "Order Details"
> form. Can you?
>
> -Tom.
> Microsoft Access MVP
>
>
> >Hi Everyone,
> >
> >While converting our apps from Access 2003 to 2007, I've come across the
> >following issue. We've a main Form which contains a Subform. In Access
> >2007, when we update the main Form's recordsource value, the subform re-opens
> >(i.e. its on open event is executed) However, this doesn't happen in Access
> >2003. Does anyone has a workaround?
>
Re: Access 2007 - Recordsource & Subform
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 11/26/2008 3:25:21 AM
On Tue, 25 Nov 2008 19:09:01 -0800, Charles Tam
<CharlesTam[ at ]discussions.microsoft.com> wrote:

Sounds like you have a good reason for your implementation. How about
using a semaphore:
Warning: untested code follows.
In the declaration section for the form:
private m_blnReassigningRecordSource as Boolean

In the form's codebehind:
Public Property Get ReassigningRecordSource() As Boolean
ReassigningRecordSource = m_blnReassigningRecordSource
End Property
Private Property Let ReassigningRecordSource(ByVal blnReassigning As
Boolean)
m_blnReassigningRecordSource = blnReassigning
End Property

In Form_Open:
ReassigningRecordSource= False

In your procedure where you reassign the recordsource:
ReassigningRecordSource = False

In the subform's Form_Open:
If Me.Parent.ReassigningRecordSource then
Exit Sub
end if

-Tom.
Microsoft Access MVP


[Quoted Text]
>Hi Tom,
>We change the main Form's recordsource, so that, the returning data could be
>determined at runtime. E.g. we would return specific records insteads of all
>records. In regards to Northwind "Order Details", unfortunately, we're not
>using the "Link Master/Child Fields", i.e. our subform is unbounded.
>
>
>"Tom van Stiphout" wrote:
>
>> On Tue, 25 Nov 2008 17:30:05 -0800, Charles Tam
>> <CharlesTam[ at ]discussions.microsoft.com> wrote:
>>
>> Why are you changing the RecordSource?
>>
>> I can't reproduce this behavior with the Northwind "Order Details"
>> form. Can you?
>>
>> -Tom.
>> Microsoft Access MVP
>>
>>
>> >Hi Everyone,
>> >
>> >While converting our apps from Access 2003 to 2007, I've come across the
>> >following issue. We've a main Form which contains a Subform. In Access
>> >2007, when we update the main Form's recordsource value, the subform re-opens
>> >(i.e. its on open event is executed) However, this doesn't happen in Access
>> >2003. Does anyone has a workaround?
>>
Re: Access 2007 - Recordsource & Subform
Charles Tam 11/26/2008 3:56:01 AM
Thanks for your suggestion, I'll try it.

I wonder why Access 2007 implements this differently than Access 2003.
Perhaps, Access 2007 has a specific approach to this implementation that we
are'nt aware of. Does anyone know about this? If so, please share your
solutions.

"Tom van Stiphout" wrote:

[Quoted Text]
> On Tue, 25 Nov 2008 19:09:01 -0800, Charles Tam
> <CharlesTam[ at ]discussions.microsoft.com> wrote:
>
> Sounds like you have a good reason for your implementation. How about
> using a semaphore:
> Warning: untested code follows.
> In the declaration section for the form:
> private m_blnReassigningRecordSource as Boolean
>
> In the form's codebehind:
> Public Property Get ReassigningRecordSource() As Boolean
> ReassigningRecordSource = m_blnReassigningRecordSource
> End Property
> Private Property Let ReassigningRecordSource(ByVal blnReassigning As
> Boolean)
> m_blnReassigningRecordSource = blnReassigning
> End Property
>
> In Form_Open:
> ReassigningRecordSource= False
>
> In your procedure where you reassign the recordsource:
> ReassigningRecordSource = False
>
> In the subform's Form_Open:
> If Me.Parent.ReassigningRecordSource then
> Exit Sub
> end if
>
> -Tom.
> Microsoft Access MVP
>
>
> >Hi Tom,
> >We change the main Form's recordsource, so that, the returning data could be
> >determined at runtime. E.g. we would return specific records insteads of all
> >records. In regards to Northwind "Order Details", unfortunately, we're not
> >using the "Link Master/Child Fields", i.e. our subform is unbounded.
> >
> >
> >"Tom van Stiphout" wrote:
> >
> >> On Tue, 25 Nov 2008 17:30:05 -0800, Charles Tam
> >> <CharlesTam[ at ]discussions.microsoft.com> wrote:
> >>
> >> Why are you changing the RecordSource?
> >>
> >> I can't reproduce this behavior with the Northwind "Order Details"
> >> form. Can you?
> >>
> >> -Tom.
> >> Microsoft Access MVP
> >>
> >>
> >> >Hi Everyone,
> >> >
> >> >While converting our apps from Access 2003 to 2007, I've come across the
> >> >following issue. We've a main Form which contains a Subform. In Access
> >> >2007, when we update the main Form's recordsource value, the subform re-opens
> >> >(i.e. its on open event is executed) However, this doesn't happen in Access
> >> >2003. Does anyone has a workaround?
> >>
>
Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 11/26/2008 7:13:56 AM
Same here, it does not happen i A2K even, I don't know why about this
inconsistancies with A2K7.

I think Tom suggestion might work, use the onopen event arguement to cancel
the event.

Charles Tam wrote:
[Quoted Text]
>Thanks for your suggestion, I'll try it.
>
>I wonder why Access 2007 implements this differently than Access 2003.
>Perhaps, Access 2007 has a specific approach to this implementation that we
>are'nt aware of. Does anyone know about this? If so, please share your
>solutions.

--
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1

Re: Access 2007 - Recordsource & Subform
Charles Tam 11/26/2008 11:36:00 PM
Hi, I've used the OnOpen event to cancel the event. Unfortunately, the
subform no longer displayed. I believe, there's because the subform is being
closed and then reopen. Is there a way to cancel the subform being close in
the first place? It seems there is not cancel argument for OnClose event?


"AccessVandal via AccessMonster.com" wrote:

[Quoted Text]
> Same here, it does not happen i A2K even, I don't know why about this
> inconsistancies with A2K7.
>
> I think Tom suggestion might work, use the onopen event arguement to cancel
> the event.
>
> Charles Tam wrote:
> >Thanks for your suggestion, I'll try it.
> >
> >I wonder why Access 2007 implements this differently than Access 2003.
> >Perhaps, Access 2007 has a specific approach to this implementation that we
> >are'nt aware of. Does anyone know about this? If so, please share your
> >solutions.
>
> --
> Please Rate the posting if helps you
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
>
>
Re: Access 2007 - Recordsource & Subform
Charles Tam 11/27/2008 12:01:02 AM
I've tried using the OnUnload to cancel the subform being closed. However,
the OnOpen event is still occuring. It seems the Access runtime is calling
OnOpen directly. Any ideas?

"Charles Tam" wrote:

[Quoted Text]
> Hi, I've used the OnOpen event to cancel the event. Unfortunately, the
> subform no longer displayed. I believe, there's because the subform is being
> closed and then reopen. Is there a way to cancel the subform being close in
> the first place? It seems there is not cancel argument for OnClose event?
>
>
> "AccessVandal via AccessMonster.com" wrote:
>
> > Same here, it does not happen i A2K even, I don't know why about this
> > inconsistancies with A2K7.
> >
> > I think Tom suggestion might work, use the onopen event arguement to cancel
> > the event.
> >
> > Charles Tam wrote:
> > >Thanks for your suggestion, I'll try it.
> > >
> > >I wonder why Access 2007 implements this differently than Access 2003.
> > >Perhaps, Access 2007 has a specific approach to this implementation that we
> > >are'nt aware of. Does anyone know about this? If so, please share your
> > >solutions.
> >
> > --
> > Please Rate the posting if helps you
> >
> > Message posted via AccessMonster.com
> > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
> >
> >
Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 11/27/2008 1:03:14 AM
Sorry about that, I thought you wanted to hide the subform.

I believe whenever you update the main form recordsource, Access 2007 reloads
the subform causing the events to execute.

Try searching the MS KB or the Hotfix. I couldn’t find anything related.

Here’s a site from Allen Browne about list of bugs.

http://www.allenbrowne.com/Access2007.html#Bugs

http://allenbrowne.com/Access2007.html


Charles Tam wrote:
[Quoted Text]
>I've tried using the OnUnload to cancel the subform being closed. However,
>the OnOpen event is still occuring. It seems the Access runtime is calling
>OnOpen directly. Any ideas?
>
>> Hi, I've used the OnOpen event to cancel the event. Unfortunately, the
>> subform no longer displayed. I believe, there's because the subform is being
>[quoted text clipped - 13 lines]
>> > >are'nt aware of. Does anyone know about this? If so, please share your
>> > >solutions.

--
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

Re: Access 2007 - Recordsource & Subform
Charles Tam 11/27/2008 1:22:01 AM
Thanks for your reply. In the meantime, I'll try to implement the feature in
another way. Any recommendation?

"AccessVandal via AccessMonster.com" wrote:

[Quoted Text]
> Sorry about that, I thought you wanted to hide the subform.
>
> I believe whenever you update the main form recordsource, Access 2007 reloads
> the subform causing the events to execute.
>
> Try searching the MS KB or the Hotfix. I couldn’t find anything related.
>
> Here’s a site from Allen Browne about list of bugs.
>
> http://www.allenbrowne.com/Access2007.html#Bugs
>
> http://allenbrowne.com/Access2007.html
>
>
> Charles Tam wrote:
> >I've tried using the OnUnload to cancel the subform being closed. However,
> >the OnOpen event is still occuring. It seems the Access runtime is calling
> >OnOpen directly. Any ideas?
> >
> >> Hi, I've used the OnOpen event to cancel the event. Unfortunately, the
> >> subform no longer displayed. I believe, there's because the subform is being
> >[quoted text clipped - 13 lines]
> >> > >are'nt aware of. Does anyone know about this? If so, please share your
> >> > >solutions.
>
> --
> Please Rate the posting if helps you
>
> Message posted via http://www.accessmonster.com
>
>
Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 11/27/2008 1:39:06 AM
Sorry, none so far.

Charles Tam wrote:
[Quoted Text]
>Thanks for your reply. In the meantime, I'll try to implement the feature in
>another way. Any recommendation?

--
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

Re: Access 2007 - Recordsource & Subform
Charles Tam 11/27/2008 2:34:00 AM
Should we inform Microsoft about this issue? If so, how?

"AccessVandal via AccessMonster.com" wrote:

[Quoted Text]
> Sorry, none so far.
>
> Charles Tam wrote:
> >Thanks for your reply. In the meantime, I'll try to implement the feature in
> >another way. Any recommendation?
>
> --
> Please Rate the posting if helps you
>
> Message posted via http://www.accessmonster.com
>
>
Re: Access 2007 - Recordsource & Subform
Marshall Barton <marshbarton[ at ]wowway.com> 11/27/2008 5:16:12 AM
Charles Tam wrote:

[Quoted Text]
>I've tried using the OnUnload to cancel the subform being closed. However,
>the OnOpen event is still occuring. It seems the Access runtime is calling
>OnOpen directly. Any ideas?
>
>"Charles Tam" wrote:
>
>> Hi, I've used the OnOpen event to cancel the event. Unfortunately, the
>> subform no longer displayed. I believe, there's because the subform is being
>> closed and then reopen. Is there a way to cancel the subform being close in
>> the first place? It seems there is not cancel argument for OnClose event?
>>

Instead of canceling the open event, try using Exit Sub

--
Marsh
MVP [MS Access]
Re: Access 2007 - Recordsource & Subform
Charles Tam 11/27/2008 5:43:00 AM
Thanks for suggestion, I've tried it. Unfortunately, it doesn't solve the
problem, because the subform is already in the openning state.

What we need is a solution such as the subform wouldn't be triggered to
reopen when its parent form's recordsource has changed. FYI: Access 2003
implemented this behaviour.

"Marshall Barton" wrote:
[Quoted Text]
>
> Instead of canceling the open event, try using Exit Sub
>
> --
> Marsh
> MVP [MS Access]
>
Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 11/28/2008 1:02:12 AM
Hi Mash,

It the inconsistency between A2K/A2K2/A2K3 and A2K7. The problem the OP in
A2K7 had was that when the main form recordsource is change, the subform
reloads causing the event to fire up. This does not happen is older versions.

Could you contact someone in MS?


Marshall Barton wrote:
[Quoted Text]
>>I've tried using the OnUnload to cancel the subform being closed. However,
>>the OnOpen event is still occuring. It seems the Access runtime is calling
>[quoted text clipped - 4 lines]
>>> closed and then reopen. Is there a way to cancel the subform being close in
>>> the first place? It seems there is not cancel argument for OnClose event?
>
>Instead of canceling the open event, try using Exit Sub

--
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1

Re: Access 2007 - Recordsource & Subform
Marshall Barton <marshbarton[ at ]wowway.com> 12/1/2008 12:24:20 AM
AccessVandal via AccessMonster.com wrote:
[Quoted Text]
>It the inconsistency between A2K/A2K2/A2K3 and A2K7. The problem the OP in
>A2K7 had was that when the main form recordsource is change, the subform
>reloads causing the event to fire up. This does not happen is older versions.
>
>Could you contact someone in MS?


I don't think I should do that at this point. My email and
newsgroup accounts were recently(?) hijacked and despite my
ISP's and my own efforts, there is no explanation as to
where/when/what/how that was done. Until I gain more
confidence that things are safe, I am very reluctant to
login to the MS private servers.

--
Marsh
MVP [MS Access]
Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 12/1/2008 1:03:15 AM
It's alright,I can understand. Even my e-mail was hi-jacked before.

Marshall Barton wrote:
[Quoted Text]
>I don't think I should do that at this point. My email and
>newsgroup accounts were recently(?) hijacked and despite my
>ISP's and my own efforts, there is no explanation as to
>where/when/what/how that was done. Until I gain more
>confidence that things are safe, I am very reluctant to
>login to the MS private servers.

--
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

Re: Access 2007 - Recordsource & Subform
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 12/1/2008 1:04:56 AM
You can try MSDN. Scroll below "Get Help from Microsoft".

http://msdn.microsoft.com/en-us/office/aa905515.aspx

Charles Tam wrote:
[Quoted Text]
>Should we inform Microsoft about this issue? If so, how?

--
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net