John Clark
John.Clark at niagaracounty.com
Wed Oct 12 07:11:35 CDT 2005
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