Show date pick always

Dick7Access

Dick S
Local time
Today, 09:19
Joined
Jun 9, 2009
Messages
4,243
Is there a way to have the date picker show always, without having to click on the date control?
 
You can have the date picker pop up automatically when the control is selected:
In the control's On Got Focus event place this code:
Code:
DoCmd.RunCommand acCmdShowDatePicker
...but I don't think you can have it always displayed. (Not the built-in control anyhow.)
 
You can have the date picker pop up automatically when the control is selected:
...but I don't think you can have it always displayed. (Not the built-in control anyhow.)

Yeh! that's the best I can do right now. When they hit new record button I have it go to the date control and the date picker shows up, but I was trying to make it idiot proof. I also put a label under the control that says, " click in the white to bring up calendar."
 
When they hit new record button I have it go to the date control and the date picker shows up, but I was trying to make it idiot proof. I also put a label under the control that says, "click in the white to bring up calendar."

That doesn't sound as if you have the DatePicker actually opening, when the Control is entered, which is what ashleedawg's code would do. As he suggested, using
Code:
Private Sub YourDateField_GotFocus()
  DoCmd.RunCommand acCmdShowDatePicker
End Sub

will automatically popup the DatePicker, when the Control is entered, without the user doing anything. Don't know how much more idiot-proofing you could do. OF course, the problem with idiot-proofing anything is that idiots are so darn ingenious!

Linq ;0)>
 
That doesn't sound as if you have the DatePicker actually opening, when the Control is entered, which is what ashleedawg's code would do. As he suggested, using
Code:
Private Sub YourDateField_GotFocus()
  DoCmd.RunCommand acCmdShowDatePicker
End Sub

will automatically popup the DatePicker, when the Control is entered, without the user doing anything. Don't know how much more idiot-proofing you could do. OF course, the problem with idiot-proofing anything is that idiots are so darn ingenious!

Linq ;0)>

Can't rspond. #WLOS (wife looking over shoulder)
 
of course, the problem with idiot-proofing anything is that idiots are so darn ingenious! Linq ;0)>

Image attached: idiotproof.jpg
 
I have indexed (no duplicates) on the date field. When I datepick a date that already has data, the date picker will accept the date, but wipes out the data in the previous record with that date. How do I make it not accept a used date? I need only one record per date.
 
...How do I make it not accept a used date? I need only one record per date...

Usually done by checking the Records in the Table for the given Date...like this:

Code:
Private Sub YourDateField_BeforeUpdate(Cancel As Integer)

If DCount("*", "YourTableName", "YourDateField = #" & Me.YourDateField & "#") > 0 Then
  Cancel = True
  MsgBox "There is Already a Record for this Date! Please Pick Another Date"
  Me.YourDateField.Undo
 End If

End Sub
Linq ;0)>
 
Perhaps you could solve both issues by using a listbox, populated ("on load") with only "available" dates. It's always visible, and forces the user to pick a date that's going to work.

(And you could make it blink with big red arrows pointing at it... Maybe that's pushing it though....) :-)
 
Why doesn't this code work?

Code:
Private Sub diaryDate_AfterUpdate()
DoCmd.GoToControl "diaryData"
End Sub

What else do I need to do?
 
trying some more idiot proofing,

Code:
Private Sub cmdFindMonth_Click()
DoCmd.ApplyFilter "qryFindMonth"
DoCmd.OpenForm "frmEveningClutter", acFormDS   ' Opens form in datasheet view
Me.cmdAll.Enabled = False
Me.cmdNew2.Enabled = False
End Sub

I am disabling two other command buttons so they can't crash if they try to click cmdNew2 or cmdAll all after they have already clicked cmdFindMonth.

Is there anyway to have a msgbox tell them that they have to pick a month if they try to click cmdNew2 or cmdAll after they already clicked cmdfindMonth?
 
I believe data validation is critical to avoid missing data and maintain data integrity.

In your button events, you could call a DataValidation function which returns true if all rules are satisfied.

Code:
if len(me.txtDateControl & "") <1 then
   msgbox "Date is missing"
   me.txtDateControl.setfocus
   exit function
endif

Include other tests as necessary ie start date is before end date.

I occasionally get called back to a system working for years where it begins crashing and I find it's some such validation test that I did not deem necessary.

I call these PEBCAK errors (problem exists between chair and keyboard). Something a bit like ID ten tee errors (ID10T). But hey, where would we be without our users?
 

Users who are viewing this thread

Back
Top Bottom