Prev: Enable control/field if in Add New Record page/form
Next: Hyperlinks to pdfs and word documents are not working
From: Hugh self taught on 4 Mar 2010 09:01 Greets to the intelligent among us...... Hi All, I have an anomaly happening with the (date picker??) I load a form to edit a record in History table using among other code, the lines Me.txtFromDate = Me.cboHistEditLookup.Column(4) Me.txtToDate = Me.cboHistEditLookup.Column(5) Then "On Click" to run my update SQL I first do the following check If Me.txtFromDate.Value > Me.txtToDate.Value Then MsgBox " The Ending Date Cannot be Before the Starting Date " Me.txtToDate.SetFocus Exit Sub End If However If when the form opens I click on the txtFromdate & use the date picker to select a new date then click my update button, the date gets updated in the table correctly but the date comparison check does not trigger. If I follow the identical route but changed the date value in the txtToDate box using the date picker, it does trigger the check. If I keyboard type values into either box then the check line triggers..!! Any ideas or suggestions why that would be or what I could do to prevent it from not triggering?
From: NuBie via AccessMonster.com on 4 Mar 2010 11:26
Maybe your datepicker returns both date and time, and at the same time you're comparing DateTime Value vs Date? MsgBox txtFromDate ' Date only Me.txtToDate ' Date only MsgBox DTPicker3 'Reruns Date and Time Hugh self taught wrote: >Greets to the intelligent among us...... > >Hi All, I have an anomaly happening with the (date picker??) > >I load a form to edit a record in History table using among other code, the >lines >Me.txtFromDate = Me.cboHistEditLookup.Column(4) >Me.txtToDate = Me.cboHistEditLookup.Column(5) > >Then "On Click" to run my update SQL I first do the following check >If Me.txtFromDate.Value > Me.txtToDate.Value Then >MsgBox " The Ending Date Cannot be Before the Starting Date " >Me.txtToDate.SetFocus >Exit Sub >End If > >However If when the form opens I click on the txtFromdate & use the date >picker to select a new date then click my update button, the date gets >updated in the table correctly but the date comparison check does not >trigger. > >If I follow the identical route but changed the date value in the txtToDate >box using the date picker, it does trigger the check. > >If I keyboard type values into either box then the check line triggers..!! > >Any ideas or suggestions why that would be or what I could do to prevent it >from not triggering? -- spread the WORD Message posted via http://www.accessmonster.com |