Date formats in query (1 Viewer)

dzelmej

Jacobs
Local time
Today, 18:58
Joined
Mar 19, 2007
Messages
16
Hi,
and again I have a problem :)

so,
In Form I have two calendar controls, and two text boxses. Based on selected date, text boxes are showing day of the year (format(Date(),"y")).

Query is based on table with records of days in year (numbers),
so, when Im trying to sort Between two numbers from Form (in this case nubers of days in year) query is reciving (imo) full date, not the number and im not getting any results.

Any non VBA ideas?

tnx
 

Attachments

  • prew4.JPG
    prew4.JPG
    59.1 KB · Views: 108

RuralGuy

AWF VIP
Local time
Today, 11:58
Joined
Jul 2, 2005
Messages
13,826
You will need to perform the same Format() function on the [field] as you have done with the controls on your form for the criteria to work.
 

dzelmej

Jacobs
Local time
Today, 18:58
Joined
Mar 19, 2007
Messages
16
but day numbers in table is numbers, they never been dates. How can I format number in to "y"? :)
I think that calendar must somehow give number value to query not formated date, but I dont know how to do it...
Maybe Im wrong...

[?]
 

RuralGuy

AWF VIP
Local time
Today, 11:58
Joined
Jul 2, 2005
Messages
13,826
Create a new field in your query:
TheDay:=Format([BDAYY],"y") and move the criteria from the [BDAYY] field to this one. You could also compare the [BDAYY] field to actual date values rather than the day of the year value.
 

dzelmej

Jacobs
Local time
Today, 18:58
Joined
Mar 19, 2007
Messages
16
well, thats not working...
it returns nothing
and how can I convert those numbers back to dates?


Off topic: why are u using coma insted of semicoln in your formula?
 

Attachments

  • prew5.JPG
    prew5.JPG
    55.4 KB · Views: 95

Users who are viewing this thread

Top Bottom