Mark A Matte
markamatte at hotmail.com
Wed Oct 12 14:18:31 CDT 2005
John, I might not be understanding your situation...but here is a more detailed description of what I used: I have MainForm (no record source)...on this form I have my text boxes used to enter criteria(also unbound)...on the MainForm I have a subform(SubformResults) that is used to display my results. The SourceObject of SubformResults is null and the SubformResults.Visible=false.(if not at this point the subform would just be a white box)...after criteria is entered and I am ready to view the results...I push a button for the following things to happen via VBA: ********** Forms!MainForm![SubformResults].Visible = True Me![SubformResults].SourceObject = "sfrmResults" ********** This refreshes the results of my subform...and if I change my criteria...and push the button again...the same code fires... ********** Forms!frmChooserecord![SubformResults].Visible = True Me![SubformResults].SourceObject = "sfrmResults" ********** ...and again the results are update. I'm not doing anything else to the form or subform. Hope this Helps...and by the way...this is in A97. Thanks, Mark A. Matte >From: "John Clark" <John.Clark at niagaracounty.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: <accessd at databaseadvisors.com> >Subject: Re: [AccessD] Form not refreshing--sometimes >Date: Wed, 12 Oct 2005 14:01:22 -0400 > >Yes, I am sorry, I had meant to mention this. Doesn't that make the >problem weirder? This IS the same thing as on the main form. > > >>> mikedorism at verizon.net 10/12/2005 1:37 PM >>> >Have you tried opening the subform by itself to make sure it is >bringing up >the right results when it isn't part of another form? > >Doris Manning >mikedorism at verizon.net > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark >Sent: Wednesday, October 12, 2005 1:19 PM >To: accessd at databaseadvisors.com >Subject: Re: [AccessD] Form not refreshing--sometimes > >Well, no...nothing seems to be working. > >I have tried: > > >'sfMoDetail.Requery >(requerying the subform control, which gave no results where there >should be two items) > >'sfMoDetail.SourceObject = sfrmMonthlyDetail >(resetting the source object of the subform control, whic totally >'blanks out' the subform control...it turns completely white) > >'Me!sfMoDetail.Form.recordsourcce = qryMonthly >(Nevermind this one...it gave an error, and looking at it I see why) > >'Me!sfMoDetail.Requery >(*** OK...this one does show promise, but it isn't exactly right >either. If I choose the drop downs first, and leave the employee >number >until last, it seems to work...I believe this hold true if I use the >keyboard as well.) > >sfMoDetail.SourceObject = qryMonthly >(This methond also "blanks out" the subform control. This has me >puzzled in itself...why would it blank it out? I'm missing something >here) > > >This is the third day in a row that I have spent time on this, and I >am >just spinning my wheels here. Most of the time a problem at least >makes >sense, as to why it is happening, and I'll tell you guys, in some way >or >another, that I am screwing up. But, this problem has me totally >stymied. I don't even know where to go next. I think it may be time to >look at alternative ways of completing the task of compiling monthly >totals...but I just know I am so >close...Ahhhhhhhhhhhhhhhhhhhh!!!!!!!!!!!!! > >Thanks > > > >>> John.Clark at niagaracounty.com 10/12/2005 8:11 AM >>> >Not silly at all...I don't think anyhow. It didn't seem to work >though. > > >However, it did produce results that made me think of another thing to >try. as I have explained, I am using a form that gathers the needed >info, and the data comes through on a subform. I think that I may be >requerying the wrong thing...maybe I need to requery that >subform...not >the subform control, but rather the actual form that I am piping in. >I've tried requerying the query and the subform control, so I am going >to try the actual form and see how that goes...once I figure out the >syntax. I've done similar before, so I've got it here somewhere. > >Thanks for your input though...it is appreciated! > >John W Clark >(The "other" John C) > > >>> markamatte at hotmail.com 10/11/2005 4:03 PM >>> >John, > >I'm not sure what is causing the problem...but...I used this method >for > >different reasons...but it should work for this...Instead of using >.requery >I set the .SourceObject of the subform each time I want it to requery. > >Hope this isn't another silly suggestion...I have been guilty of that >lately. > >Thanks, > >Mark A. Matte > >From: "John Clark" <John.Clark at niagaracounty.com> > >Reply-To: Access Developers discussion and problem > >solving<accessd at databaseadvisors.com> > >To: <accessd at databaseadvisors.com> > >Subject: [AccessD] Form not refreshing--sometimes > >Date: Tue, 11 Oct 2005 14:21:08 -0400 > > > >I've working on an A2K form (frmMonthly) that is sends parameters to > >query (qryMonthly), which in turn provides data for a subform > >(sfMoDetail) on this same form. Basically you type in an employee >number > >and a year (both text boxes...yr defaults to current year), choose a > >time off type and a month (each using combo boxes), and it fills in a > >starting date and ending date, in the fields, "txtBegDate" and > >"txtEndDate." The query uses "txtEmpNum", "cboTOType", "txtBegDate" >and > >"txtEndDate" to return the dates and times that an employee took off > >that month. > > > >This works like a charm, if I type in an employee number (10080 is my > >test), and pick from the combos w/the mouse...the year is untouched, > >because it is already the current year and my test month is JUN, >2005. > >However, if I use the keyboard only to pick everything, nothing is > >returned, even if I then revert to using the mouse...once I've used >the > >keyboard, I must exit the form and enter it again, for it to work. > > > >I currently have absolutely no clue as to why this is happening. >After > >each of the fields (not including "txtEmpNum") the AfterUpdate event > >fires and calls a sub called "SetDates." This sub, as you can >probably > >guess, sets the values of "txtBegDate" and "txtEndDate" and then > >requeries the subform. The dates are being filled in correctly, in >both > >scenarios, and I have temporarily added two text boxes to verify that > >the values being passed to the query are what I am expecting. As I >was > >writing this, it occurred to me that I hadn't tried running the query > >directly in my troubleshooting process, while using the keyboard...I > >just did and the query itself runs. > > > >The code in the sub, which probably has nothing to do with this, is: > > > >***************************************** BEG CODE SNIPPET > >************************************** > >Private Sub SetDates() > > > >Dim NumDays As Integer > >Dim SummaryText As String > > > >Select Case cboMonth.Value > > Case 1, 3, 5, 7, 8, 10, 12 'Jan, Mar, May, Jul, >Aug, > >Oct, & Dec have 31 days > > NumDays = 31 > > Case 4, 6, 9, 11 'Apr, Jun, Sep, & Nov >have > >30 days > > NumDays = 30 > > Case 2 'February - could be >leap > >year > > > > If txtYr.Value Mod 100 = 0 Then 'If it is a century >year, > >it must be div. by 400. > > If txtYr.Value Mod 400 = 0 Then > > NumDays = 29 > > Else > > NumDays = 28 > > End If > > Else 'If not century yr, test >if > >div by 4 for leap yr. > > If txtYr.Value Mod 4 = 0 Then > > NumDays = 29 > > Else > > NumDays = 28 > > End If > > End If > > > >End Select > > > >'Set Beg & End dates for given month, for use as parameters in query > >txtBegDate.Value = cboMonth.Value & "/" & 1 & "/" & txtYr.Value > >txtEndDate.Value = cboMonth.Value & "/" & NumDays & "/" & txtYr.Value > > > >'Set summary text to let user know exactly what is being queried > >SummaryText = "This data represents all " & cboTOType.Value & " time > >taken, for employee " > >SummaryText = SummaryText & txtEmpNum & ", for " & cboMonth.Value & >", > >" & txtYr > >lblSummary.Caption = SummaryText > > > >sfMoDetail.Requery > > > >End Sub > >***************************************** END CODE SNIPPET > >************************************** > > > >Please save my sanity and send me a clue here! > > > >Take care! > > > >John W Clark > >-- > >AccessD mailing list > >AccessD at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/accessd > >Website: http://www.databaseadvisors.com > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com