Problems refreshing form

Hayley Baxter

Registered User.
Local time
Today, 23:55
Joined
Dec 11, 2001
Messages
1,607
I am having problems trying to refresh my form. I have tried the following:

me!frmclients.refresh on after update event but this does not work.

I am adding a new client record so after the new entry had been added I want to refresh the form so I can add new contacts for the client on my second form that links to the first.

If I choose records, refresh from the menu it works but I need to do this automatically because it is no good from the menu unless people remember to do this everytime..we all know how likely that is don't we?

Any help with this please?

Thanks a lot
Hay
 
Hey Hayley,

you need to requery. Problem is that you'll lose your "place" so capture your current position, then requery/refresh, then go back to that position.

Like so:
intTempRecordNum = Forms!frmclients.CurrentRecord
Forms!frmclients.Requery
Forms!frmclients.Refresh
DoCmd.GoToRecord , , acFirst
DoCmd.GoToRecord acDataForm, "frmclients", acGoTo, intTempRecordNum

I still have much to learn at Access so someone may have a better solution (to which I will also be interested!)

Hope that helps!

-Sean
 
Just save the record Haley, refreshing the form from the toolbar is forcing the save,
DoCmd.RunCommand acCommandSaveRecord,
 
Thanks

Thanks for the replys guys I actually got it working by puting

me.form.refresh

Ta
Hayley
 
G'day Hayley, haven't heard from you for awhile, thought some one might have pulled the plug on your internet connection.:D
Dave
 
I'm still here!

Hello Dave

How are you? I've been rather busy of late always seem to be running around doing something. I haven't even managed to have a look at the second sample you sent me but I'm sure you've done a good job as always been quite impressed with your work so far.

All the best
Hayley
 
It is always better to write code that does explicitly what you want.

DoCmd.RunCommand acCommandSaveRecord - does exactly what you want

me.form.refresh - does what you want but only as a side effect
 
Hi Pat

Obviously I want to go about this in the correct way but when I tried Rich suggestion I couldn't get this to work for me. It kept throwing up an error.

Any ideas why?

Hay
 
There must be something else in play. The rest of the code, the form's recordsource, ....?
 
I guess we have failing eyesight Haley, it's actually
DoCmd.RunCommand acCmdSaveRecord:o
 

Users who are viewing this thread

Back
Top Bottom