If it is MS Date Picker control, better use it's CloseUp event (or Change event - but CloseUp is likely to give best results).
 
A.D.Tejpal
--------------
 
----- Original Message -----
Sent: Friday, September 16, 2005 05:13
Subject: [AccessDevelopers] Calendar Update Event

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



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to