Hi everyone,
I am working on a record selector by using buttons which are developed by code. Here it is the database example ( http://www.mvp-access.com/-marta-/we...27&orden=&tipo= ). You can download the database in "Descargar Ejemplo". There are 3 buttons which are superimposed of each other.
Also I have posted this before (https://www.accessforums.net/showthread.php?t=76441). But Unfortunately, for me it was a difficult code to use. Anyway, I want to thank again Isladogs for all the help
The problem is that I have another code which work as a filter when certain fields are filled. But the record selector does not adjust to that filter. Instead of limiting to the number of records that have been searched, it does not.
The filter has two buttons.
-One for applying the search (Buscar Referencia). The purpose of this buttons is to look up by aproximation a certain reference or codigo RFQ. For example:
My goal is to obtain something like this using the initial code.
Code:
Private Sub btn_BuscaReferencia_Click()
Dim vBuscaReferencia As String
Dim vBuscaCodigoRFQ As String
Dim vLargo As Integer
Dim miFiltro As String
'--------------------------
vBuscaReferencia = Nz(Me.cbo_BuscaReferencia.Value, "")
vBuscaCodigoRFQ = Nz(Me.cbo_BuscaCodigoRFQ.Value, "")
'--------------------------
miFiltro = ""
If vBuscaReferencia <> "" Then
miFiltro = "AND [REFERENCIA] LIKE '*" & vBuscaReferencia & "*'"
End If
If vBuscaCodigoRFQ <> "" Then
miFiltro = "AND [codigoRFQ] LIKE '*" & vBuscaCodigoRFQ & "*'"
End If
'--------------------------
vLargo = Len(miFiltro)
If vLargo > 0 Then
miFiltro = Right(miFiltro, vLargo - 4)
End If
'------------------------
If DCount("*", "aa_DatosRecibidos", miFiltro) = 0 Then ' TABLE
MsgBox "Los valores introducidos no se corresponden con ninguna REFERENCIA o CÓDIGO RFQ" ' There are no references or codigo RFQ related to the initial values entered.
Else
Me.Filter = miFiltro
Me.FilterOn = True
End If
End Sub
And Undo search (Deshacer búsqueda):
Code:
Private Sub btn_DeshaceReferencia_Click()
Me.cbo_BuscaReferencia.Value = Null
Me.cbo_BuscaCodigoRFQ.Value = Null
Me.FilterOn = False
End Sub
So, how do I implement the code which defines the record selector when the filter is applied and change according to the number of records filtered? What are the conditions I have to introduce?
Thank you in advance