zelarra821
Registered User.
- Local time
- Today, 17:27
- Joined
- Jan 14, 2019
- Messages
- 813
Good afternoon.
I have a continuous form that I filter through a few dropdowns (SrchMultimedia, SrchCategoria, SrchSubcategoria). The filter is applied through the source query of the form. I attach images for you to see (como = like):
There you can see SrchMultimedia, but it is the same for the others.
After updating that dropdown, I have a custom function to set the dropdown row origin to its right (SrchCategoria), instructing it to clear whatever value the dropdown has (SrchCategoria y SrchSubcategoria):
When I put a debug.print after that function to know the Recordsource it is taking, I see that it is not effectively cleaning the criteria.
As you can see, it has not erased the category criteria, despite having told it to do so (Category = 'El Mundo').
The After update event is this:
No matter how much I think about it, I am not able to figure out why it does it. See if someone can help me.
Thanks a lot.
I have a continuous form that I filter through a few dropdowns (SrchMultimedia, SrchCategoria, SrchSubcategoria). The filter is applied through the source query of the form. I attach images for you to see (como = like):
There you can see SrchMultimedia, but it is the same for the others.
After updating that dropdown, I have a custom function to set the dropdown row origin to its right (SrchCategoria), instructing it to clear whatever value the dropdown has (SrchCategoria y SrchSubcategoria):
Code:
Function DespuesDeActualizarElMultimedia(FName As Form, Tabla As String, CodigoCategoria As String, CodigoSubcategoria As String)
FName.SrchCategoria.RowSource = "SELECT Categoria As Categoría, Sum(1) AS Archivos, TipoMultimedia As Multimedia" _
& " FROM TTiposDeMultimedia INNER JOIN (TCategorias INNER JOIN " & Tabla & " ON TCategorias.CodigoCategoria = " & CodigoCategoria & ") ON TTiposDeMultimedia.CodigoTipoMultimedia = TCategorias.CodigoTipoDeMultimedia" _
& " WHERE TCategorias.CodigoCategoria <> 1 And CodigoEstado=" & DLookup("CodigoEstado", "TEstados", "Estado='" & FName.SrchEstado & "'") & " And TipoMultimedia='" & FName.SrchMultimedia & "'" _
& " GROUP BY Categoria, TipoMultimedia, TCategorias.CodigoCategoria, CodigoEstado" _
& " ORDER BY TipoMultimedia, Categoria"
FName.SrchSubcategoria.RowSource = "SELECT Subcategoria As Subcategoría, Sum(1) AS Archivos" _
& " FROM TTiposDeMultimedia INNER JOIN (TSubcategorias INNER JOIN (TCategorias INNER JOIN " & Tabla & " ON TCategorias.CodigoCategoria = " & CodigoCategoria & ") ON TSubcategorias.CodigoSubcategoria = " & CodigoSubcategoria & ") ON TTiposDeMultimedia.CodigoTipoMultimedia = TCategorias.CodigoTipoDeMultimedia" _
& " WHERE TSubcategorias.CodigoSubcategoria <> 1 And CodigoEstado =" & DLookup("CodigoEstado", "TEstados", "Estado='" & FName.SrchEstado & "'") & " And TipoMultimedia='" & FName.SrchMultimedia & "'" _
& " GROUP BY Subcategoria" _
& " ORDER BY Subcategoria"
FName.SrchCategoria = ""
FName.SrchSubcategoria = ""
End Function
When I put a debug.print after that function to know the Recordsource it is taking, I see that it is not effectively cleaning the criteria.
Code:
SELECT ID, Nombre, fncQuitarAcentos([Nombre]) AS Nombre1, TVideos.CodigoEstado, TVideos.CodigoCategoria, TVideos.CodigoSubcategoria, Duracion, FechaDescargado, FechaInicio, FechaFin, FechaBorrado, Estado, Categoria, Subcategoria, Observaciones, IIf(IsNull([Observaciones]),[Observaciones],fncQuitarAcentos([Observaciones])) AS Observaciones1, TipoMultimedia FROM TTiposDeMultimedia INNER JOIN (TSubcategorias INNER JOIN (TEstados INNER JOIN (TCategorias INNER JOIN TVideos ON TCategorias.CodigoCategoria = TVideos.CodigoCategoria) ON TEstados.CodigoEstado = TVideos.CodigoEstado) ON TSubcategorias.CodigoSubcategoria = TVideos.CodigoSubcategoria) ON TTiposDeMultimedia.CodigoTipoMultimedia = TCategorias.CodigoTipoDeMultimedia WHERE fncQuitarAcentos([Nombre]) Like '*' & [Forms]![FVideos]![SrchText] & '*' And Estado Like '*' & [Forms]![FVideos]![SrchEstado] & '*' And Categoria = 'El Mundo' And Subcategoria Like '*' & [Forms]![FVideos]![SrchSubcategoria] And TipoMultimedia Like '*' & [Forms]![FVideos]![SrchMultimedia] &
'*' AND Duracion Between #0:10:00# And #0:20:00# Or Estado Like '*' & [Forms]![FVideos]![SrchEstado] & '*' And Categoria ='El Mundo' And Subcategoria Like '*' & [Forms]![FVideos]![SrchSubcategoria] And IIf(IsNull([Observaciones]), [Observaciones], fncQuitarAcentos([Observaciones])) Like '*' & [Forms]![FVideos]![SrchText] & '*' And TipoMultimedia Like '*' & [Forms]![FVideos]![SrchMultimedia] & '*' AND Duracion Between #0:10:00# And #0:20:00# ORDER BY Duracion
As you can see, it has not erased the category criteria, despite having told it to do so (Category = 'El Mundo').
The After update event is this:
Code:
Private Sub SrchMultimedia_AfterUpdate()
Application.Echo False
If DuracionActivo = False Then
Call DespuesDeActualizarElMultimedia(Me, "TVideos", "TVideos.CodigoCategoria", "TVideos.CodigoSubcategoria")
Else
Call DespuesDeActualizarElMultimediaDuracion(Me, "TVideos", "TVideos.CodigoCategoria", "TVideos.CodigoSubcategoria")
End If
AlEntrarMultimedia = True
Me.Requery
Call PersonalizarVista(Me, "TVideos", True, "CodigoEstado", DLookup("CodigoEstado", "TEstados", "Estado='" & Me.SrchEstado & "'"))
Me.SrchMultimedia.SetFocus
Application.Echo True
End Sub
No matter how much I think about it, I am not able to figure out why it does it. See if someone can help me.
Thanks a lot.
Last edited: