Jump to content

activar macro segun fecha


Recommended Posts

Estoy intentando que una macro se active en una fecha determinada cada año pero no consigo completar le parte que resalto en rojo.

Sub DESCATALOGAR()

Call CONEXIONBBDD

Dim sqlX As String

Set rstX = New ADODB.Recordset

Dim sqlY As String

Set rstY = New ADODB.Recordset

'Dim curso As Date

If Day(Date) = 9 And Month(Date) = 9 Then

'On Error Resume Next

sqlX = "UPDATE LIBROS SET LIBROS.Descatalogado = True;"

With rstX

.CursorLocation = adUseClient

.CursorType = adOpenKeyset

.LockType = adLockOptimistic

.Open sqlX, cnn, , , adCmdText

End With

' curso = Year(Date) & "/" & Right(Year(Date) + 1, 2)

sqlY = "UPDATE LIBROS SET LIBROS.Descatalogado = False WHERE (((LIBROS.Ciclo)='" & User_FechaF.Text_Fecha & "'));"

With rstY

.CursorLocation = adUseClient

.CursorType = adOpenKeyset

.LockType = adLockOptimistic

.Open sqlY, cnn, , , adCmdText

End With

End If

Set rstX = Nothing

Set rstY = Nothing

End Sub

Alguien me puede echar una mano por favor.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

Privacy Policy