Requerying Data Ina Subform

Jun 22, 2007

Hi Folks

I have a query based on a table which gives a breakdown of sales by month, sale type and by cost centre (department).

I also have another query which summarises the sales by sale type and cost centre so that and is based on the first query.

the second query is a subform of the first. I tried the second query as an update query but couldn't figure out how to execute it in order to refresh the subform. I've also tried to requery the second query having recreated it as a select query but I'm not able to refresh the data.

The aim is to refresh the data in the subform as any of the underlying data is changed in the original form.

I'm ok with VBA and with macros so if anyone has any advise or ideas I'd appreciate it.

Many thanks

Andy

View Replies


ADVERTISEMENT

Subform Blues - Data Entry Setting Itself To 'No' & Requerying 1 Subform From Another

Dec 5, 2006

2 Subform problems

I have a data entry subform that is only supposed to show an empty record ready to be populated, and a display records subform that is supposed to show all the records. The subforms are both on the same tab of a tab control on my main form.

Problem 1:
The data entry subform shows all the records rather than a blank record. Something on my main form is causing it to show the records when it should not. Any ideas? The Data Entry is set to Yes.

To try to isolate the problem, I created a new form and added the subform to it where it behaves properly:confused:

I then added Me.DataEntry = True to the form open to see if that would solve my problem but it still sets the data entry to no.

If I have the properties box open when in form view of my main form, I can set the data entry to Yes and it works fine until I move to the next record of the main form when it resets to no. Teraing my hair out here.:mad:

My final attempt was to search the entire project to see if there is a "DataEntry = False" somewhere but there isn't. What is setting this property? Any ideas where I should look?


Problem 2:

After entering data in the first subform (data entry form), I want to re-query the second subform but I just can't get the syntax right. I have wrestled with the "Syntax for subs" document downloaded from http://www.mvps.org/access/forms/frm0031.htm (Microsoft MVP site) but to no avail.

My main form is called fdlgPrjDetails, the data entry is via fsubPrjCommentsUsersDataEntry and the subform I wish to requery is fsubPrjCommentsUsers.

None of the attempts below worked giving a cannot find control error.


Private Sub Form_AfterUpdate()
On Error GoTo ErrHandler

Me.Requery

'Me!fsubPrjCommentsUsers.Requery
'Me!fsubPrjCommentsUsers.Form.RecordSource.Requery
'DoCmd.Requery ([fsubPrjCommentsUsers])
'DoCmd.Requery [fsubPrjCommentsUsers]

ExitHere:
Exit Sub

ErrHandler:
MsgBox Err.Number & " - " & Err.Description & Chr(13) _
& Chr(13) & "Error in fsubPrjCommentsUsersDataEntry: Err 003"
Resume ExitHere
End Sub


Any Ideas?

Both problems have me stumped so I'll be grateful to anybody with a scoobie on this.:)

View 10 Replies View Related

Subform Keeps Requerying

Jun 23, 2006

Greetings. I have a database that displays forecasts of our faculty needs. I now have 2 tables, Managers and classes.
The Managers are bound to the form, the Classes to the subform.
The subform changes every time I choose a new manager,
as planned. But the Subform keeps requerying itsself,
and I can't enter/modify data as a result.

View 7 Replies View Related

Forms :: Requerying Values In A Subform After Updating Combo Box In Main Form

Apr 21, 2015

Within my main form I have a combo box called "workgroup." Also in the main form is a subform called "sfrmSubmissionRecords," and within this subform is a combo box called "covermemo."

Each cover memo is assigned to a specific workgroup, so my intention is for each time a new workgroup is selected from the dropdown, the covermemo combo box in the subform becomes populated only with the covermemos associated with that workgroup. I'm almost finished except for the final step when I try to make the values regenerate...Access says that can't find the referenced form "sfrmSubmissionRecords"

This is the code that I'm using:

Private Sub cmbWorkgroup_AfterUpdate()
Forms![sfrmSubmissionRecords]![cmbCovermemo].Requery
End Sub

View 2 Replies View Related

Forms :: Requerying Subreport On Tabbed Control - Show Related Data

Jul 4, 2014

I have a form with a tabbed control on it. The tabbed control has 4 tabs that each have a report on them. When I select a company name on the main form, I requery these 4 reports to show data related to that company.

For some strange reason, 2 of my reports requery with no problem, and 2 of them give me a message that the report can't be found. Here is the code:

Code:
Private Sub cboCompanyName_AfterUpdate()
On Error GoTo cboCompanyName_AfterUpdate_Err
' DoCmd.SearchForRecord , "", acFirst, "[CompanyID] = " & str(Nz(Screen.ActiveControl, 0))

' After selecting a company, requery the subreports to display the appropriate data

' These 2 work

Forms!frmCompanyHistory!RptCompany_Projects_Brief.Requery
Forms!frmCompanyHistory!RptEmployeesSpecificCompany.Requery
'These 2 Fail
Forms!frmCompanyHistory!SubRptCompany_Payback.Requery
Forms!frmCompanyHistory!SubRptCompany_Revenue.Requery

'Other things I've tried

'Forms!frmCompanyHistory!TabCtl66!SubRptCompany_Payback.Requery
'Me.TabCtl66!SubRptCompany_Revenue.Requery

As a side note, if I chose the company, say "ok" to the error, and then go run the queries that these reports are based on, I get the correct records. Also, if I chose the company and run the 2 failing reports standalone, they work fine, so I know the problem isn't the reports or the queries themselves.

I have also checked and rechecked for any spelling mistakes and have found none. I should mention that the error message is "Programs cannot find the field 'SubrptCompany_Payback' referred to in your expression".

View 8 Replies View Related

Forms :: Requerying A Combo Box

Jul 10, 2014

I am having trouble requerying a combo box.I have created a Drawing Register database which allows users to create a new job as well as set up a drawing register for that job if the use checks a box in the job set-up form which indicates that particular job will have a register.Using the Job-Set up form I created a query which brings pulls the job number, job name and register check box and filtered it to show only those jobs that the box is checked. To this query I also added the relevant fields from the drawing register table. The Job Set Up table is linked to the Drawing Register table by the Contract No. field. Unfortunately I cannot set this field in the Job Set Up table.

Using this query I created a Drawing Register form with the sub-form Drawing Register Details. I added a combo box which shows the lists of all the drawings and allows me to view a specific drawing when selected. The problem I am getting is that the list is showing ALL drawings for EVERY job with a register and not just those drawings for the job I am currently updating. I tried using the following code with no luck

Private Sub Form_Load()
Forms![DwgRegFRM].Form![Combo15].Requery
End Sub

Private Sub Combo15_GotFocus()
[Combo15].Requery
End Sub

I want that when I choose to open the register for a particular job the combo box only lists the drawings for that particular job.

View 6 Replies View Related

Requerying / Refreshing After Form Is Closed.

Sep 25, 2005

Hi all,

I am stumped as to how to get a form to update/refresh. Heres what I have!
My main form:[Daily Log From] is opened, with a subform:[DailyDSQry subform] populated by a Query. This form has a command button that opens another form: [NewDSLog] in "acAdd","acDialog".
What I need is: when the [NewDSLog] form closes, the [DailyDSQry Subform] needs to requery/update so that it displays the new entry.

I have tried the following in a command "CLOSE" button in form [NewDSLog]:
docmd.Runcommand AcCmdRecordSave
Me!Forms![Daily Log]![DailyDSQry subform].Refesh
Me!Forms![DailyDSQry subform].[Query].!Requery
doCmd.close

but no LUCK.....Keep getting errors
Any Ideas
Thanks all, I do appreciate the help
Enviva

View 1 Replies View Related

When Using Cascading Combos - Requerying Other Fields

Oct 6, 2005

OK ive got my 2 vaguely working combos which select the surgery, and the staff.

On the same form I want a couple of tickboxes which show for example, whether a person attended the course, if they had to pay etc (all yes/no answers).

How do I get the tickbox to update? i have tried to requery it but nothing happens, it just stays as what the last thing done to it was.

SHould i be using a subform here do you think?

View 1 Replies View Related

Forms :: Requerying A Form When Another Closes

Oct 26, 2013

I have a main form populated by Dlookups.When I click on a textbox I open another form which is used to change data in my main table. Once this is closed the main form is still displayed but the amended data isnt reflected in this form. How do i get the data to change, I have tried requerying the form and the query that is used for the dlookups but I cant get it to work.

View 5 Replies View Related

Forms :: Requerying Combo Box After NotInList Event

Sep 10, 2014

I have a form with a subform that contains a combobox where I choose companies to add to a project that is on the main form. If the user types in a company name that is not in the database, I run code on the NotInList event that passes the company name using openargs to a company entry form.

After this form is closed, I return to the subform to choose the company name that I just added, only it is not there because I can't figure out where to automatically requery this combobox. My duct tape solution that's working, is a command button that runs this code when clicked:

Code:

Forms!frmProjects_Detail_CSS!ASP_Project.Form!cbocompany.Requery

I have tried putting this code in the OnCurrent, OnFocus, Onclick, OnEnter....etc on the subform and on the combobox itself. So far the only way it requeries is if I use the command button.if you want to see the NotInList code, and the code on my company entry form.

View 5 Replies View Related

Queries :: Requerying A List Box Based On A Query

Oct 3, 2014

I have a list box (List25) that is generated from a query (qryThisBox). One of the fields in that query uses the criteria [Forms]![MyForm]![SelectedField] to filter.I also have combo boxes in the form that List25 displays in. Unfortunately, I want to requery the list box in the form, using a combo box that calls the same underlying table field, SelectedField.

How can I do this? Can I somehow dynamically change the criteria in qryThisBox to change when it gets requeried?How do I stack combo box requeries, eg: Combo Box 1 gets selected - does a requery

and/or

Combo Box 2 gets selected - and filters the results of the requery for Combo Box 1.

View 1 Replies View Related

Forms :: Display Data In Form As Select Record In Subform In Data Sheet View

Nov 11, 2013

i have a main form named(EMP) i have a subform named(SEMP)with EMPID i have an another form Named(SDetail) with EMPID i want to open form Sdetail with filter records for data select in subform (SEMP) ,EMPID field Subform SEMP in as datasheet view. i can open sdetail for selected records only

View 14 Replies View Related

Subform Data To Mainform Data

Jan 9, 2006

Would like to be able to update a text field on the main form with information from a dropdown box on a subform when the subform data equals a certain value. Would like the main form field to update as soon as the subform information is selected from the dropdown box.

Example (sorry don't have code for it)

Mainform field = Mytext
Subform dropdown field = Newtext1, or Newtext2, or Newtext3

If Newtext2 is selected on subform, I would like Mytext to immediatly show the value in this field (mainform/mytext). Do not want either Newtext1, or 3 to ever show in Mytext but want it to remain in subform field

It can either be on Lostfocus from subform or onupdate from subform, etc.

Whatever works best/easiest
Thanks for the help in advance

View 1 Replies View Related

Subform Data To Mainform Data

Jan 9, 2006

Would like to be able to update a text field on the main form with information from a dropdown box on a subform when the subform data equals a certain value. Would like the main form field to update as soon as the subform information is selected from the dropdown box.

Example (sorry don't have code for it)

Mainform field = Mytext
Subform dropdown field = Newtext1, or Newtext2, or Newtext3

If Newtext2 is selected on subform, I would like Mytext to immediatly show the value in this field (mainform/mytext). Do not want either Newtext1, or 3 to ever show in Mytext but want it to remain in subform field

It can either be on Lostfocus from subform or onupdate from subform, etc.

Whatever works best/easiest
Thanks for the help in advance

View 1 Replies View Related

Subform Data

Jun 29, 2005

I have a contact names form (datasheet) which lists contact names under certain criteria. What I want is a subform that then lists all other contact names for this company.(When you click the +)

So the linked fields are CompID for the parent and the child.

I do not however want to see the parent record again in the sub records - is there a way to remove it.

Thanks

View 8 Replies View Related

Disappearing Data In Subform

Apr 9, 2006

I have a form with an unbound subform that was working quite nicely. The only change I made was changing the data source for the main form from a query to a static table; name of table same as the prior query. Now the subform appears but the data doesn't. The buttons in the subform header are visible and work but the detail is not visible when displayed as a subform, it is fine if I open the subform as a separate form, I see the correct records based on the main form's criteria.

I have searched for some property I may have accidentally changed but can't find anything. It isn't set in data entry mode, not even a blank line shows.

Has anyone had this happen?

View 4 Replies View Related

Refreshing Subform Data

Jul 31, 2005

G'day,

Currently I have a button on my form that opens a second for to Add a New Temp Worker. This all works fine but when I close the form and go back to the entry form the subform hasn't been refreshed and so the new temp isn't in the list. I can't close the form that contains the subform as it will stuff up the data entry.

Can you please help?

Bizzy

View 14 Replies View Related

Appending Data With Subform

Apr 22, 2008

:( my database is a basic Customer Product Orders model.
i am have trouble when i try to append orders to my archiveOrders table. this error appears.
Microsoft Access can't append all the records in the append query.
Aicrosoft Access set 0 fields to Null due to type conversion failuer, and it didn't add 1 records to the table due to key violation, 0 records due to lock violation, and 0 records due to validation rule violation.
im very new to Access and there other thread i kinda couldn't understand :P.
i have added my database and the current append query i im designing is called qappOrders.
i really do need help, don't no where to start:(


Any help will be greatly appreciated.

View 3 Replies View Related

How To Get Data From Subform As Datasheet

Jan 23, 2005

I have a form (Main) with a subform (MainSub) set as a datasheet.

The main form holds details of employees and the subform holds targets and dates for the employees.

the subform has 4 fields, Target, StartDate, EndDate, AchieveDate.

What i would like to do, is show the date of the target that was achieved last on the main form.

For example,

Joe Young has 3 aims, 2 of which are complete and 1 which is still ongoing.
Joe achieved his targets on 31/11/04 and 31/12/04.
On the main form I would like to show a control called 'LastTargetAchieved' as 31/12/04.

If I am not making myself clear I will see if I can get a sample uploaded, otherwise, thanks for any help.

View 2 Replies View Related

I Can Add Data Into Form But Not In The Subform.

May 3, 2005

Hi,
I want to add data into form frmStaff. Form frmStaff has subform sfrmStaffDetails. When i click on Add button, it will open frmStaff. I can add data into frmStaff but cannot add data into sfrmStaffDetails.
This is the code,

Private Sub cmdAdd_Click()
DoCmd.OpenForm "frmStaff", , , , acFormAdd
End Sub


Any idea?
Thanx in advance.

View 1 Replies View Related

How To Access Row Data In A Subform

May 5, 2005

I have a sub form that shows items booked for a person, this subform is refreshed everytime a new item is booked. I want to be able to add commission so I have a combo on the main form that has commision rates in it.

I have a click event on the row in the subform with the hope that I could click a particular product and then if user clicks the description then the click event will add the commision due on that particular item.

the row is [prodid] [desc] [cost]

the question is how do i access the row data on the subform?

in this case I have grabbed the commission rate from the combo and now want the cost from the row i clicked.


regards in advance
peter

View 4 Replies View Related

Limiting Subform Data

Jul 8, 2005

Hi,

I'm baffled by this ...

One of the forms in my database has a subform. The subform displays data from a table which is related to the data in the main form (also powered by a table) through a key relationship. So long as the relationships are set up correctly, the correct data magically appears in the subform as you scroll through the records in the main form.

I've tried to do this a second time, except in this instance the subform is displaying data from a query, and the data is related to the data in the main form not through a direct key, but through a link table. I've set up the relationships properly as before, but this time the subform stubbornly displays all the data from the query, not just that which is related to the record in the main form.

What am I doing wrong?

View 2 Replies View Related

How To Save The Subform Data?

Aug 28, 2005

Hi everybody, i am an U Student from Singapore.and i am a new MS ACCESS learner. So please kindly advice me a question about MS ACCESS.
I created one form called MonthlyTransaction. Inside this Form, i have another sub-form called Forecast. So my question is how do i save the MonthlyTransaction data into monthlyTransaction table and Forecast data into Forecast table? But the field name in Forecast table called MonthlyTransID is the value of MonthlyTransID in the MonthlyTransaction table.


Thanks very very much in advanced for yours help.

Regards.
Wilmos Lee.

View 2 Replies View Related

How To Populate Data In Subform?

Dec 11, 2005

I have 3 inputs based on which i'll fetch records from table in a subform for the given input criteria. Please let me know how to populate subform programmatically?

I tried source object property and form.recordsource property. It gives me some error or the other. let me know the right syntax to do the above mentioned.

Thanks in advance,
jwala :)

View 1 Replies View Related

Selecting Data From Subform

Jan 17, 2006

Each record in the database has a subform (one to many relationship) with multiple records. When the user clicks on a record in the subform I want the information from the subform and from the mainform to go into a Word document. I am able to pull the data from the main form but not from the sub form. Any suggestions would be appreciated. Below is an example of what I am using to get the data out of the main form for the bookmark in Word called "ClientName".

.ActiveDocument.Bookmarks("ClientName").Select
.Selection.Text = (CStr(Forms!frmClients!txtFName) & " " & (Forms!frmClients!txtLName))

View 3 Replies View Related

Edit Data On A Subform

Mar 28, 2006

To make a long story short I have a command button that runs a query and opens a subform based on that query. I want to be able to update the records that are returned (via the subform) but I am getting an error - "This Recordset is not updateable". I've tried changing the recordset property to Dynaset (Inconsistent Updates) but that didn't seem to change anything.

Anyone point me in the right direction?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved