Two Combo boxes dealing with dates

dmp

New member
Local time
Today, 06:02
Joined
Jan 4, 2011
Messages
7
Hello,
I have a form that contains five combo boxes two of which have an activeX control “ using the calendar Control 12.0 . The first date represents the “Beginning Date” and the second represents the “End Date”. My problem is:
· It’s not retrieving all data between these two dates. It only retrieves if I select an exact date in the table.
· I also want to write an “error code” in case the end-user adds a date in the wrong order. Such as the Beginning Date = Jan-01-11 and the End Date = Jan-01-10. I want this code to create a message box explaining the error.
Thank you for any assistance
I’m new to the form and I’m not sure if my attachment is connected correctly therefore I have added my code to the bottom of this message as well.
Option Compare Database
Option Explicit
Private Sub btn_Cancel_INDUCTION_Click()
DoCmd.Close acForm, "frm_COMPLETE_INDUCTIONS_User_Request"
End Sub

Private Sub btn_Complete_INDUCTION_run_Click()
DoCmd.OpenQuery "qry_Parameter_Complete_Induction", acViewNormal, acEdit
DoCmd.Close acForm, "frm_COMPLETE_INDUCTIONS_User_Request"
End Sub

Private Sub Calendar_INDUCTIONS_begDate_Click()
cmb_INDUCTIONS_bdate.Value = Calendar_INDUCTIONS_begDate.Value
cmb_INDUCTIONS_bdate.SetFocus
Calendar_INDUCTIONS_begDate.Visible = False
End Sub

Private Sub Calendar_INDUCTIONS_endDate_Click()
cmb_INDUCTIONS_edate.Value = Calendar_INDUCTIONS_endDate.Value
cmb_INDUCTIONS_edate.SetFocus
Calendar_INDUCTIONS_endDate.Visible = False
End Sub

Private Sub cmb_INDUCTIONS_bdate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Calendar_INDUCTIONS_begDate.Visible = True
Calendar_INDUCTIONS_begDate.SetFocus
If Not IsNull(cmb_INDUCTIONS_bdate) Then
Calendar_INDUCTIONS_begDate.Value = cmb_INDUCTIONS_bdate
Else
Calendar_INDUCTIONS_begDate.Value = Date
cmb_INDUCTIONS_bdate.Value = Date
End If
End Sub

Private Sub cmb_INDUCTIONS_edate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Calendar_INDUCTIONS_endDate.Visible = True
Calendar_INDUCTIONS_endDate.SetFocus
If Not IsNull(cmb_INDUCTIONS_edate) Then
Calendar_INDUCTIONS_endDate.Value = cmb_INDUCTIONS_edate
Else
Calendar_INDUCTIONS_endDate.Value = Date
cmb_INDUCTIONS_edate.Value = Date
End If
End Sub
 
What version of Access are you using?
 
Sorry, I should have added that to my posting I'm using Access 2007.
 
Why are you using a calendar control when A2007 has smart calanders for date type fields on forms.
 

Users who are viewing this thread

Back
Top Bottom