Hope someone can possibly point me in the right direction here. This form
has to be implemented Monday morning good or bad, and I'm still really stuck.
Any help or pointers would be very much appreciated!
(OK, the 1st question was way too general but it feels kind of presumptious
asking you to wade through 4 feet of text in a 3 inch wide message pane.)
Basically, I just need to add txtHr, txtMin and txtAmPm to the date string
captured by the calendar control. Calendar is Allen Browne's popup form:
http://www.allenbrowne.com/ser-51.html unbound control (Windows XP,
Access2003, db is still Access2k)
3 specific questions:
(1)
Can't find which bits of code are returning the selected date back to the
main form (frmExample, textbox txtStartDate). I can find the 3 procedures
that look like they're related to capturing the desired date, but the
DateSerial part only has year & month, no day. Also tried to change
DateSerial to DateValue so I could capture date/time but can't work out the
syntax for that either. (code below)
(2)
this section (commented out) appears in the instructions at the beginning of
the code:
==========
'You also need this code in a standard module:
'---------------------standard module code begins-------------------------
'Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.
etc.
=========
But then the module "ajbCalendar" includes this code:
=========
Option Compare Database
Option Explicit
'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.
Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
On Error GoTo Err_Handler
etc.
========
Does this mean you need this code in a second module for some reason? Or
does module "ajbCalendar" take care of that already?
(3)
Is there a way to have the txtAmPm auto-calculate itself? Business hours
are 8-5 so I used the following default value:
=IIf("[txtHr]=12","PM",IIf("[txtHr]<8","PM","AM")) and
Private Sub TxtHr_LostFocus()
Me.txtAm.Requery
End Sub
but even when txtHr is blank it always shows PM (?) I also tried it in the
OnChange event for txtHr.
code (1)
Private Function SetSelected(ctlName As String)
On Error GoTo Err_Handler
Me.txtDate = DateSerial(Year(txtDate), Month(txtDate),
CLng(Me(ctlName).Caption))
Call ShowHighligher(ctlName)
Exit_Handler:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation,
conMod & ".SetSelected"
Resume Exit_Handler
End Function
Private Function SelectDate(ctlName As String)
Call SetSelected(ctlName)
Call cmdOk_Click
End Function
Private Function SetDate(Unit As String, Optional intStep As Integer = 1)
On Error GoTo Err_Handler
Me.txtDate = DateAdd(Unit, intStep, Me.txtDate)
Call ShowCal
Exit_Handler:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation,
conMod & ".SetDate"
Resume Exit_Handler
End Function
============
Also tried to use John Viesca's calendar that already has date/time but some
table is missing so the year combo doesn't work. Trying to rebuild the year
table makes the calendar show all wrong days for the date selected. The
arrows for year work great for recent dates but inefficient for entering old
dates, date of birth, etc.
Thanks in advance,