Refresh problems

tomdee

Registered User.
Local time
Today, 22:48
Joined
Jul 27, 2004
Messages
16
Hi,
I hope someone can give me a hand with this problem as I've been struggling with it for days and haven't got anywhere.

I have a form with a subform on it. The subform has a few command buttons. The buttons modify some of the data on the main form and I need the have the data on the main form refeshed after the buttons are clicked. This works fine for one of the buttons but it won't work on the other. The command I'm using is:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

The extra confusing thing is that if I manually click a refresh button after clicking the problem button then it refreshes properly. I really need to have this automated so is there any other method that anyone can suggest?

TIA
Tom
 
Since I don't have A95 loaded, I have no idea what item #5 is on the Records Menu. Don't use these old doMenuItem commands. No one can read them and even Microsoft tells you not to use them.

I'm guessing that this is a refresh command. The problem is that it applies to the current object which is the subform. If you want to refresh the parent form, you need to set focus to it firsts.

Use the DoCmd.RunCommand to first set focus to the mainform and then run the refresh and then set focus back to the subform. I don't have time to look up the specifics. Intellisense should do it for you. Just search the dropdown list that appears when you type the command.
 
Hi,
Thanks for response, I've managed to get the issue resolved now. Interestingly I'm using access XP and those old command were from using the wizard to create a command button. I got it working by simply doing a me.parent.requery

Thanks again
Tom
 
Yes, Microsoft doesn't follow its own advice. The wizards still generate that obsolete code even in A2003!
 

Users who are viewing this thread

Back
Top Bottom