Odd problem refreshing when datasheet has focus?

rudeboymcc

Registered User.
Local time
Yesterday, 16:04
Joined
Sep 9, 2008
Messages
69
Hi. I've got a split form based on a pass through query of a list of names. When the user clicks on the name, it opens up the contact details for them to edit. When they close it, I want the list of names to reflect the changes.

If I put the code to open the "details" form on the actual name as a hyperlink (so clicking on teh name will bring up the details), the datasheet will not refresh with me.requery.

However, if I click on the form header, and then press F5, the datasheet refreshes.

Why is this? It's like the datasheet half cannot refresh if it has focus.
 
Me thinks it's a timing issue, it all depends on when you issue the Requery.

Consider this:

Code:
Sub()
Docmd.OpenForm "SomeForm"
Me.Requery
End Sub

This will open the edit form and requery the calling form Before you have a chance to make any changes.

Code:
Sub()
DoCmd.OpenForm "SomeForm",,,,,, [B]acDialog[/B]
Me.Requery
End Sub

This will halt the code execution until the "SomeForm" is closed, before it execute Me.Requery.

The 3. option will be to requery the calling form in the CloseEvent of "SomeForm"

Forms![NameOfSplitForm].Requery

Hope this helps.

JR
 
Last edited:
I don't think it is because after th
e code is done, pressing f5 doesn't work either. where as clicking out of the database and then pressing f5 works fine.

I've tried doing a set .focus on something outside the database but it errors saying its not possible at this time.
 

Users who are viewing this thread

Back
Top Bottom