date field filter in a form fails

kapiszon292929

New member
Local time
Today, 17:51
Joined
Jun 21, 2008
Messages
6
Hi,

I have a small problem that I driving me mad and I can't progress with my work. I don't know why the following code doesn't work. When I execute it, there is simply no effect, no error message, nothing...

Code:
Private Sub CuadroDateFilter_AfterUpdate()

Me.Filter = "Falta=" & "#" & Me.CuadroDateFilter.Value & "#"
Me.Filter = True

End Sub
Do you have any suggestions?
 

Attachments

  • AccessBBDD.jpg
    AccessBBDD.jpg
    97 KB · Views: 106
I can't say that I am sure what you are trying to do and that looks like 2007 which I don't have, however the dates appear to be left justified in the controls which suggests that they are text not dates which appear as right justified, maybe that is the problem.

Brian
 
and, i might be wrong, but isnt it

Me.Filter = "Falta= #" & Me.CuadroDateFilter.Value & "#"
 
after using rainman89's code use me.refresh
 
filter

It didn't work, I don't know why. The filter didn't work at all. But I resolved that problem in a different way: I saved the filter as a query and then I run it using a macro with ApplyFilter Command.

But now I have another problem. I need another filter to filter out record by Person or Destination. I tried to do it in exactly the same way as before, I created a query that indicates which records to filter, then I run a new macro with ApplyFilter and it doesn't work. There is a window that pops up saying that it cannot find a field called CuadroDestFilter in my form...

That's strange, because the name of the ComboBox is correct, it's called CuadroDestFilter. In the mentioned query in the criteria row I included the filter instuction:

Like "*" & [Forms]![ComentsForm]![CuadroDestFilt]

I have no idea why this query/macro cannot find a value in that ComboBox called CuadroDestFilter... Have you ever come across a similar issue?
 
filters

Yes, I did. Look, let's have a look at it step by step:

This is the filter query that I use in my macro in ApplyFilter command:

Code:
SELECT *
FROM (SELECT Comentarios.*, reservas.Hotel, reservas.Destino, reservas.Pais, reservas.Benef, reservas.Rentab, reservas.[Falta] FROM reservas LEFT JOIN Comentarios ON reservas.ID=Comentarios.ID)  AS ComentsForm
WHERE (((ComentsForm.Destino) Like "*" & [Forms]![ComentsForm]![CuadroDestFilt]));

But even this query fails when I run it. The pop up window indicates that it cannot find the Combo Box, it says "Enter parameter value: Forms!ComentsForm!CuadroDestFilt"

I don't know why it cannot find this field...
 
filter

No idea what was wrong, when I tried later to run the first filter By Date, if it stopped to work and was getting a pop up window telling me that it can't find the right Combo Box.

I deleted this file, and started over once again. And this time it worked perfectly... I did exactly the same as before, no changes were made to the code, however, it works fine now. I'm puzzled but happy that the filters work ok.

weird...
 

Users who are viewing this thread

Back
Top Bottom