Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

activar macro segun fecha

publicado

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.

Featured Replies

publicado

me llama la atención la triple comilla en el criterio SQL, ademas el punto y coma al final del WHERE

publicado
  • Autor

El problema lo tengo en cambiar la parte en rojo por la variable curso que esta en verde.

Andrés

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.