I played around with this this morning and figured out that my code will run when it is behind the on exit or on lost focus event. I still have no idea why it does not work on the on update event? If anyone knows why, I am still interested in that. Thanks
--- In [email protected], "chrisman052003" <[EMAIL PROTECTED]> wrote: > I have the following code in the Update Event of a Calendar but it > does nothing. I put the same code behind a command button and the > code works. > I put an text box on the form and made the control source the > calendar. After I select a month, then day and tab out of the > calendar the correct date appears in the in the text box, but my > code won't run > Does anyone know why the "Update" will not run the code? > Thanks > Chris > > Private Sub CalDate_Updated(Code As Integer) > MsgBox "1" > Dim db As DAO.Database > Dim rst As DAO.Recordset > Dim strSQL As String > > Set db = CurrentDb > > strSQL = "SELECT tblTimecard.Client_ID, DatePart(""d"",[TCDt]) AS > DayCd, " & _ > "tblTimecard.Hrs, DatePart(""m"",[tcdt]) AS MthCd, DatePart > (""yyyy"",[TCDt]) " & _ > "AS YrCd, tblTimecard.TCDt, tblTimecard.activityDt " & _ > "FROM tblTimecard " & _ > "WHERE (((tblTimecard.Client_ID)=[forms]![frmTimeCard]. > [Client_ID]) " & _ > "AND ((DatePart(""m"",[tcdt]))=[forms]![frmTimeCard]. > [txTimeCardMonth]) " & _ > "AND ((DatePart(""yyyy"",[TCDt]))=[forms]![frmTimeCard]. > [txTimeCardYear]));" > MsgBox strSQL > db.QueryDefs("qry_TC_Finished_01").SQL = strSQL > MsgBox db.QueryDefs("qry_TC_Finished_01").SQL > > Me.ctl_frm_Finished.SourceObject = "frm_Finished" > End Sub ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/q7folB/TM --------------------------------------------------------------------~-> Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
