G
Gremlin
Hi
I have two pop up calendars that allow the user to choose a date range on a
form along with a list box of diagnosis. The purpose of the form is to find
multiple laboratory values that were drawn during a certain time range. This
form is linked to run a query. The code is as follows:
Option Compare Database
Option Explicit
Dim cboOriginator As ComboBox
Private Sub calendar_Click()
cbostartdate.Value = calendar.Value
cbostartdate.SetFocus
calendar.Visible = False
End Sub
Private Sub calendar2_Click()
cboEndDate.Value = calendar2.Value
cboEndDate.SetFocus
calendar2.Visible = False
End Sub
Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set cboOriginator = cbostartdate
calendar2.Visible = True
calendar2.SetFocus
If Not IsNull(cboOriginator) Then
calendar2.Value = cboOriginator.Value
Else
calendar2.Value = Date
End If
End Sub
Private Sub cbostartdate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
calendar.Visible = True
calendar.SetFocus
If Not IsNull(cbostartdate) Then
calendar.Value = cbostartdate.Value
Else
calendar.Value = Date
End If
End Sub
Private Sub cmdcancel_Click()
DoCmd.Close acForm, "frmLabs"
End Sub
Private Sub cmdOK_Click()
End Sub
Private Sub labcmd_Click()
On Error GoTo Err_labcmd_Click
Dim stDocName As String
stDocName = "qrylabs"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_labcmd_Click:
Exit Sub
Err_labcmd_Click:
MsgBox Err.Description
Resume Exit_labcmd_Click
End Sub
I have two pop up calendars that allow the user to choose a date range on a
form along with a list box of diagnosis. The purpose of the form is to find
multiple laboratory values that were drawn during a certain time range. This
form is linked to run a query. The code is as follows:
Option Compare Database
Option Explicit
Dim cboOriginator As ComboBox
Private Sub calendar_Click()
cbostartdate.Value = calendar.Value
cbostartdate.SetFocus
calendar.Visible = False
End Sub
Private Sub calendar2_Click()
cboEndDate.Value = calendar2.Value
cboEndDate.SetFocus
calendar2.Visible = False
End Sub
Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Set cboOriginator = cbostartdate
calendar2.Visible = True
calendar2.SetFocus
If Not IsNull(cboOriginator) Then
calendar2.Value = cboOriginator.Value
Else
calendar2.Value = Date
End If
End Sub
Private Sub cbostartdate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
calendar.Visible = True
calendar.SetFocus
If Not IsNull(cbostartdate) Then
calendar.Value = cbostartdate.Value
Else
calendar.Value = Date
End If
End Sub
Private Sub cmdcancel_Click()
DoCmd.Close acForm, "frmLabs"
End Sub
Private Sub cmdOK_Click()
End Sub
Private Sub labcmd_Click()
On Error GoTo Err_labcmd_Click
Dim stDocName As String
stDocName = "qrylabs"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_labcmd_Click:
Exit Sub
Err_labcmd_Click:
MsgBox Err.Description
Resume Exit_labcmd_Click
End Sub