Updating a subform (within a Form) using vba based on specific selections - Access 20

Status
Not open for further replies.

ramanan1986

Registered User.
Local time
Today, 14:41
Joined
Mar 8, 2013
Messages
10
Hi,

I have a Form named 'Opening_Screen' which consists of various objects - Combo Boxes, RadioButtons, Check Boxes which the user can select.

There is a subform called 'Report' within the 'Opening_Screen'. The source object of the subform is a query (called 'QueryX').

There is a button called 'Generate Report' on the form which when clicked - an SQL must run on the backend, update the query which in turn should update the Subform 'Report'.

For me, the QueryX gets updated, but the subform doesn't. When I manually switch the form to Design View and then back to Form View - the subform gets updated. I tried the same through the vba code instead, but it doesn't update the subform.

Any suggestions how to work this out.

Pls let me know in case you want any more details.
 
you probably just need to requery your form - to test, hit F9 and see if the subform is updated

If this is the case then at the end of the code in your afterupdate of your 'generate report' button put either

me.requery 'to udpate the whole form or
subformname.requery ' to just update the subform
 
Hi,

I have a Form named 'Opening_Screen' which consists of various objects - Combo Boxes, RadioButtons, Check Boxes which the user can select.

There is a subform called 'Report' within the 'Opening_Screen'. The source object of the subform is a query (called 'QueryX').

There is a button called 'Generate Report' on the form which when clicked - an SQL must run on the backend, update the query which in turn should update the Subform 'Report'.

For me, the QueryX gets updated, but the subform doesn't. When I manually switch the form to Design View and then back to Form View - the subform gets updated. I tried the same through the vba code instead, but it doesn't update the subform.

Any suggestions how to work this out.

Pls let me know in case you want any more details.

You have given a bunch of information but some of it is confusing.

First you should not have Queries in the back end. Is this the case for you or did you just described things incorrectly. I would think you are refering to a query in the Database window of the Front End. The Back End should only have Tables.

You refer to a Report. Again is it really a Report or are you calling a Sub Form a Report because it displays Filtered information.

TheRequery Command is written differently depending on where the Button is and what needs requering.

I have a Paper on Naming Conventions that may help you. You can find it by clicking on the link in my signature.

Finally I will ask for this Thread to be moved as it is strictly for introductions not questions.

I will ask for it to be moved to the General Section.

Please post back if you have further problems.
 
Hi Rain,

@ Queries - You are right. The backend is a Table. The Query I am referring to is on the Front End.

@Report - I am referring Subform as the report.

The fields in this subform can be dynamic, i.e., it might have a Date column when a date selection is made & the same column must be replaced with a Week column when a week selection is made.

When I try using:
SubformName.Form.RecordSource = the SQL

The Date column is filled when a Date selection is made. When a week selection is made, the date column remains empty but the values in other fields change.
 
There is at least one other thread with exactly the same questions

http://www.access-programmers.co.uk/forums/showthread.php?p=1240453&posted=1#post1240453

Are you guys working on the same problem? If so, might be an idea to combine resources

The Date column is filled when a Date selection is made. When a week selection is made, the date column remains empty but the values in other fields change.

Do you have a 'weeks' field in your subform? if so, is it empty when you select date?
 
Are you going to be saying this soon?

even some version have 8 fields and for some query it can be 14 fields also..for that i want to update..
 
Moved this thread to the more appropriate Forms forum.
 
I hadn't read the thread, just responded to the request to move it. I'll close it now.
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom