' Form module: ConsultarFechas ' Description: Date selection form with refactored code Dim b_Export As Boolean Private Sub b_completar_Click() ' Process data without exporting b_Export = False ProcessFormData Unload Me End Sub Private Sub b_completar_exportar_Click() ' Process data and export b_Export = True ProcessFormData Unload Me End Sub Private Sub ProcessFormData() Dim fechaDesde As Date, fechaHasta As Date ' Parse dates from form inputs fechaDesde = GetDateFromString(Me.t_desde.Value) fechaHasta = GetDateFromString(Me.t_hasta.Value) ' Process the work hour data ProcessWorkHourData fechaDesde, fechaHasta, b_Export, Me.frm_factnro.Value End Sub