Requery Subform (1 Viewer)

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Hi
I have one subform (subformname) that I would like to requery when updating with data another form (PipForm).
When I press a button which save data on (PipForm) i have setted this code:
Code:
Me.Parent.Subformname.Form.Requery
But get error that object is missing.
I have no idea how to update (subformname) after I have input data on (PipForm)
 

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
I tried the follow:
Code:
Forms![Mainformname]![Subformname].Form.Requery
But having the form which contain the form open nothing happen.
If I close the form containing the subform and Reopen it is there.
I would like to update the subform in realtime when saving PipForm button
 

fvdb

Registered User.
Local time
Today, 10:23
Joined
Aug 24, 2015
Messages
67
Instead of your code place this
Code:
DoCmd.Requery

It will refresh your form

You put your code in a sub onclick of the buttom?
 
Last edited:

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Update. I cannot run
Code:
Forms![Mainformname]![Subformname].Form.Requery

Beacuse it does not find the form
Code:
mainformname
 

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Instead of your code place this
Code:
DoCmd.Requery
It will refresh your form

You put your code in a sub onclick of the buttom?

I cannot Use Docmd.Requery because the button is on a third form (PipForm). I dont think it is the right way
 

fvdb

Registered User.
Local time
Today, 10:23
Joined
Aug 24, 2015
Messages
67
What are the name of the forms? Pipform is the form with the button

What is the name of the form with the subform you want to requery? What is the name of the subform?

Code:
 Forms!nameMainform!nameSubform.Form.Requery

should do the work
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
Doing exactly the same thing I use the following VBA code as the last action of a button press on a completely separate form from the one where the requery is required:

Code:
Forms!frmPartsMain.frmPartsList.Requery

where frmPartsMain is the main form and frmPartsList is the sub-form within it.

This works perfectly for me.
 

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Tried both solution but it does not works.
It does not update. Tried also to refresh after requery but nothing happen. I can only close and reopen the form.
My code
Code:
Forms.Mainformname.Subformname.Requery

PIPForm is the form with button that should be Requery and update the Subform
 

jdraw

Super Moderator
Staff member
Local time
Today, 04:23
Joined
Jan 23, 2006
Messages
15,414
Suggest you post your database. (zip format)
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
Code:
Forms!Mainformname.Subformname.Requery
not
Code:
Forms.Mainformname.Subformname.Requery

It is an exclamation mark after the forms, not a full stop.
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
or alternatively you can spend half a day trying every possible option until it works like I did :rolleyes:
 

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Code:
Forms!Mainformname.Subformname.Requery
not
Code:
Forms.Mainformname.Subformname.Requery
It is an exclamation mark after the forms, not a full stop.

I mistyped. sorry . Point or exclamation point it does not works
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
Code:
Forms!FRMMesePrecedentePIP.[FRMSottomaschera QueryPIPConcatRelatedsuMesePrecedente].Requery

I think you have put an underscore in to represent the space and you cannot do this, you need to keep the space and bracket the sub-form (I think). Also drop the .Form at the end.

In order to look at this properly people would need the backend database as well as the front end.

On a personal note I would shorten all my form, table and query names to small single items such as FRMsqpcrmp - that way you don't have issues with typing and bracketing.
 
Last edited:

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
Yes in fact I put underscore for spacing. Anyway I have brackened as you suggest but nothing happen.
I have work_BE but that I built is an example exported database.
Thanks for your suggestion :)
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
I hope you noticed I edited my previous response.

The DB1 that you sent still links to a _be and therefore is difficult to debug without it.
 

raphael99

Registered User.
Local time
Today, 01:23
Joined
Apr 6, 2015
Messages
126
I'm working on a splitted database named Work. The only BE I have is Work_BE.
I include it . But I don't know if it works because the Db1 I sent it is built for the forum and it is not split.
Anyway I upload also Work_BE
View attachment work_be.zip
 

Tieval

Still Clueless
Local time
Today, 09:23
Joined
Jun 26, 2015
Messages
475
Code:
Forms!FRMMesePrecedentePIP.[FRMSottomaschera QueryPIPConcatRelatedsuMesePrecedente].Form.Requery

Ok, you still need to remove the .Form but the biggest issue is that FRMMesePrecedentePIP does not exist in the database, it does not get past this.
 

Users who are viewing this thread

Top Bottom