Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date carry over to next record not working.

Status
Not open for further replies.

starclassic

Technical User
May 24, 2007
27
US
Hello everyone,
For some reason the txtExpDate_AfterUpdate()
does not carry the date to next record. If date is entered manualy will work but if I choose the date from the form Calendar thats pop up when click doesn't carry the value to next record. Any Ideas.I try everything and seems not working.

Private Sub txtExpDate_AfterUpdate()
Me.txtExpDate.DefaultValue = "#" & Me.txtExpDate & "#"
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module
Option Compare Database

Public olddate As Date

Public Originator As Control
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub txtExpDate_Click()
'open form calendar to select date.

Dim stDocName As String
stDocName = "frmCalendar"

Set Originator = Me.txtExpDate
olddate = IIf(IsDate(Me.txtExpDate.Value), Me.txtExpDate.Value, Now)
DoCmd.OpenForm stDocName, , , , , acDialog

Exit_txtExpDate_Click:
Exit Sub

Err_txtExpDate_Click:
MsgBox Err.Description
Resume Exit_txtExpDate_Click
End Sub
 
After trial and error I was able to get it workin.

Thanks...
 
I will post it after I clean up all the bugs out... Thank
 
Here's final code

Private Sub txtExpDate_AfterUpdate()
If IsNull(Me.txtExpDate) Then
Exit Sub
ElseIf CDate(Me.txtExpDate) < CDate(Now) Then
MsgBox "Expiration date entered should be greater than date today", vbInformation, "Lunch Voucher"
Me.txtExpDate = ""
Me.txtExpDate.SetFocus
Exit Sub
Else
Me.txtExpDate.DefaultValue = "#" & CDate(Me.txtExpDate) & "#"

End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top