Topics Search

How to requery main form before opening subform.

How to requery main form before opening subform.
Views: 42
I have a main form and a subform. The subform displays fields also visible in the main form such as 'Name'. When I click a button on the main form it opens this subform. The problem is this:

Everything works fine with existing records, but when I click a button on the main form, to open up the subform, the Name field in the subform is blank, unlike that of the main form, which has just been filled in. Both forms are linked to the same 'name' field in an underlying table.

So I suspect, filling in the 'name' field in the main form, only updates the underlying table upon closing the main form (or changing the record?). What I want it to do is to update the main table as soon as the name text box has been filled in, in the main form. I hope this is clear
Sponsored Links:

Similar posts...


Update text box on main form afterupdate of subform

Update text box on main form afterupdate of subform Icon
I have a text box located on the main form. I would like to requery the total given in the text box (based on a query) on the AfterUpdate event of a subform. I have a second subform that uses the same query and can get it to update fine, but the text box will requery the entire form.

This would not be a problem, but the user can enter time for previous days, and therefore the requery moves the previous days records to the chronological order.

The short, is on an AfterUpdate event on the subform, how can I requery just the text box on the main form?

Requery Subform

Requery Subform Icon
How to requery the subform based on date range after update in Main form. Example: The forecast quantity in main form was revised based on the new startdate and enddate. How do I requery thesubform in order to revise the forecast quantity?

requery a combo in subform from main form

requery a combo in subform from main form Icon
I have a main form frmInspections that has a subform frmEquipment

I am trying to requery a combo in subform (cmbEquipDetails) based on a selection in the main forms combo box

I thought this code should work however it is not
in afterupdate of first combo

Forms!frmInspections!frmEquipment.Form![cmbEquipDetails].Requery = True

requery subform

requery subform Icon
I have a date field on a subform that is defaulted to the date field on the main form. When I change the main form's date, I want the subform's date to change as well.

To do this I am using the "requery" command in the "on change" event property of the main form's date field. When I open the forms, the defaults all work, but when I change the date on the main form, the subform requeries to show the data that is in it's table, Is there a better option than requery?

Search Box Requerying Subform problem

Search Box Requerying Subform problem Icon
I'm trying to build a text box to filter a subform. I have the main form "Navigation", the subform "Loan Search subform" and the textbox "Search"

When I run the Loan Search query with Search populated, it filters and works correctly. When I try to have it requery automatically, it doesn't seem to.

I have tried every combination of

Forms![Navigation]![Loan Search Subform].Requery
Me![Loan Search subform].Form.Requery

that I can think of. Some throw error messages. but no requery occurs.

Subform requery Access 2007

Subform requery Access 2007 Icon
I have a form in ms access 2007, with multiple tabs. Some of these tabs have subforms.
I want to update one subform from another but am having no joy. I cannot requery the second subform. ive read alot of threads about requery, referencing the main form and then subform2, the subform control name v's form name etc but still no joy.

Subform1 sets up the data displayed in subform2 - so depending on subfrom1 some fields in subform2 could be hidden or placed in a particular position on the form. I have this visible/not visible code in the onload event of subform2. This works well if the main form is closed after subform1 is updated. When I reopen the main form subform2 is displayed correctly.

I know the subforms are already "loaded" when the main form is opened but how can I get subform2 to reload when subform1 is updated. Should I have my formatting code of subform2 in a differnt event than onload? Is requery the correct command to use? when i want to esentially reload subform2.

.requery Method and the OnQuery Event

.requery Method and the OnQuery Event Icon
I have an Access 2007 database. I have a form frmMain with a subform frmSub. In the main form I have a Save button. When the Save button is clicked, the main and related records are checked to see if the necessary detail has been entered.

When checked, if the related record is not complete, the user has the option to either edit or delete the incomplete related record.

If the record is deleted, then the subform is requeried to show the updated records (rather than the #Deleted entry).

All of that works as it should. BUT! There is a label in the header of the subform that displays a count of the records in the subform. It is updated OnLoad , OnQuery, OnCurrent and OnDataSetChange.

However, when I requery the subform using Forms!frmMain.frmSub.Form.Requery the label is not updated.

Should any of the above events be triggered by the .Requery Method?

unbound subform requery/new

unbound subform requery/new Icon
Have an unbound subform ; it is a continuous form; it is set for Data Entry in its form property.

when the main form first opens is well - the subform is blank; after the user populates some info into the subform - then I need to press a button on the main form and "refresh" the subform to a blank slate.

gotonew record just moves the record selector to the bottom new record - leaving the existing data showing.

other than closing the main form manually - and reopening - - I don't see a way to reset this subform.

Requery subform in tab

Requery subform in tab Icon
I have a main form called Activity Log which has four tabs on it. Each tab has a different subform. When one form has a date entered it alters information (actions) on another tab via code. When the user then clicks on the Action tab I want the latest to display. I assumed I needed to requery this subform which is Named ActionLog (name not source object) and tried by entering the following code on the onclick event of the Actions tab:

Forms![Activity Log]![ActionLog].Form.Requery

but it doesn't show the latest data. If I close the main form and reopen the Actions are correct so I know the data is changing correctly

Only allow a button to HIDE a subform, and not show the subform.

Only allow a button to HIDE a subform, and not show the subform. Icon
I have a main form that opens up a sub form based on criteria entered into the main form. After the info is entered into the sub form, I use a button on the main form (tied to the code below) to hide the sub form.

I need to prevent the user from opening up the sub form manually by pressing this button on the main form. I only want the sub form to pop up automatically when the criteria is met in the fields of my main form.

What do I need to do to this button so that it can only be used for closing the sub form, and cannot be used for opening it manually?