Noticias:

Reinstalando todo...

Menú Principal

Desplegar selector de fecha

Iniciado por xavi, Enero 23, 2021, 10:05:11 PM

Tema anterior - Siguiente tema

xavi

Palabras clave: fecha, desplegar, datapicker, selector
Autor: Missinglinq
Extraído de: Access Forums


Pregunta
¿Cómo puedo desplegar automáticamente el selector de fecha al entrar en un cuadro de texto?

Respuesta
En el evento al recibir enfoque (GotFocus) desplegamos el selector. En el evento Al cambiar, mandamos el foco a otro control


Private Sub DateField_GotFocus()
  DoCmd.RunCommand acCmdShowDatePicker
End Sub

Private Sub DateField_Change()
  Me.AnotherControl.SetFocus
End Sub

Private Sub DateField_AfterUpdate()
  'AfterUpdate code goes here
End Sub


Si el cuadro de texto fuera el primer control del formulario podríamos simular el proceso con el evento Timer


Private Sub Form_Load()
  Me.TimerInterval = 1
End Sub

Private Sub Form_Timer()
  Me.TimerInterval = 0
  Me.DateField.SetFocus
  DoCmd.RunCommand acCmdShowDatePicker
End Sub