Refresh/Requery Problem

wannabe

Registered User.
Local time
Today, 22:19
Joined
Feb 13, 2000
Messages
14
Hi All,
I have a tab control on my main form, and subforms on the different tabs. On the tab/subform I also have a command button to add a record to the subform. This works great.
My problem is that when I close the pop up form after adding a new record, the added record does not appear on my subform until I back out to the menu and then re-access the form with the subform.
I have tried
Forms!frmMainForm.frmSubform.Forms.Requery
(which I might add, I'm using elsewhere in my program, only not on a tab control)
I have this code added to the Activate Event on my frmMainForm but when I try to load the form I get the infamous
Run-time Error 2465
Application-defined or Object-define Error.

Can anyone help me out with this. I running into a deadline and really need this working.
TIA,
Emily :confused:
 
try
if "frmMainForm.frmSubform" isn't the actual name of your form then replace them with the names that you've given your forms

otherwise...if those are the names of your forms then try...

Forms!frmMainForm.frmSubform.Form.Requery
 
Me.frmSubform.Requery
 
Thanks for the quick response guys but Casey, that was a typo on my part. I do not have the 's' on Form.Requery, and Pat I tried using just the Me!frmSubform.Form.Requery and I still get the generic Run-time 2465.
Like I said before I do have this working on another form, the only thing different is that this form has the subform on a tab control. Does this make a difference?
:confused: :confused:
Emily
 
Thanks Rich this time I don't get any error messages, however, the subform doesn't refresh either.
:(
 
Thanks again Rich,
I'm assuming I was leaving this code in the Activate event of the subform. I tried adding the brackets, still no error but doesn't reqery either.
 
I don't think you will have success with the On Activate event of the subform, as this event does not fire unless the subform is opened by itself (as a parent).

When existing as a subform, the only attached event relative to the parent are "on enter" and "on exit"


Pat's suggestion earlier works for me without fail, with or without a tabbed control.

Brad.
 
Sorry for the delay in getting back to you all. I ended up with the flu which pretty much wiped me out. Working on my Access project was the last thing on my mind. But it' Monday morning and I'm feeling better and ready to solve this problem once and for all.

Pat, I realize I read your first post incorrectly. So I removed the Form and just typed in Me.frmSubform.Requery. That still gave me the 2465 error. So I tried, Me.Requery. No error but didn't refresh my form with the added data. So then I tried adding the code to the OnActivate event of the subform itself. Still new data does not show up.

What is really frustrating is that I have this code working elsewhere in my program and it works great! I was thinking it would be helpful if I could attach a copy of my database but I don't know how.

Still looking for help and thanks again for all of you that have tried helping so far.

Emily :(
 
Try
DoCmd.RunCmd.acCmdSaveRecord
Forms!frmMainForm.frmSubform.Form.Requery
on the unload event of the pop up
 
You need to refer to the subform by the name of the CONTROL, not the name you see in the database window.

Me.YourSubformCONTROLName.Requery
 

Users who are viewing this thread

Back
Top Bottom