[AccessD] find the right event

Jim Lawrence accessd at shaw.ca
Wed Mar 30 18:51:53 CDT 2011


Thanks for the help Jim and Stuart

It was not as simple as initially planned but finally a hack that works:
(Believe me, I tried ever other method first...and this is the only one that
really works.)

'1. Turn off display
'2. Set focus to the calling form
'3. Save current record position on calling form
'4. Set field in calling form to required value
'5. Force update to calling form by 'refreshing' record source
'6. Position back to appropriate calling form record
'7. set focus to modular form
'8. Turn on display
 
Dim bolStatusFlag
Dim lngInvoiceID As Long
Dim rs As Object
    
bolStatusFlag = Me.Closed
    
Application.Echo False
[Forms]![Invoice Header].SetFocus

lngInvoiceID = [Forms]![Invoice Header].[InvoiceID]

' Set one field...    
[Forms]![Invoice Header].[Work Description].Locked = bolStatusFlag
    
[Forms]![Invoice Header].RecordSource = "Invoice Open"
    
Set rs = [Forms]![Invoice Header].RecordsetClone
rs.FindFirst "[InvoiceID] = " & lngInvoiceID
If Not rs.EOF Then [Forms]![Invoice Header].Bookmark = rs.Bookmark
    
Me.SetFocus
Application.Echo True


Hope this helps somebody. ;-)

Jim



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jm.hwsn
Sent: Wednesday, March 30, 2011 12:19 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] find the right event

Why not requery Form ONE when the status field on Form TWO is toggled/

HTH
Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence
Sent: Wednesday, March 30, 2011 2:08 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] find the right event

Hi All:

I have just been given the project to update an Access database 2003.

I am a little foggy on some of the methods and event so here is the
question.

On form TWO a status field is toggled and then the form is closed. Form ONE,
which was already open also has the same status field as in form TWO. Note:
If you move off the current record, on form ONE, and back on again the
status field updates correctly.

The issue is that I would like to have some way or be able to monitor some
event within code to know that there has been a change to the form
recordsource/record so the appropriate requery/refresh can be performed. 

So far I have found no form event that is triggered upon focus back to form
ONE other than the Activate event but no programmed action can be performed
at this point.

It does seem that this should be very simple.

TIA
Jim

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list