Textbox date value

Precips1

Registered User.
Local time
Today, 18:36
Joined
Dec 28, 2010
Messages
35
Hi need help

I have a couple of fields in a query, [RegistrationDate] and [ExpireDate]

Person completes a course and enters the date in the RegistrationDate field which is a form textbox. ExpireDate is the calculated base on a number of years I've added as a validation period. eg.. 2 years

So if 22/11/2013 is entered, [ExpireDate] returns 22/11/2015
This all works fine.

What I'm trying to do is create a report that will return all values of the [ExpireDate] equals 2015 or what ever date is entered into a textbox on the form.

On a form "PrintOptions" I have a [textbox29] which I've formatted to show just the year. eg Format(Date(),"yyyy")

In the query, critera under the [ExpireDate] field, I've tried using:-
Like [forms]![frmPrintOptions]![textbox29]

But this doesn't return anything.

Please help

Mike
 
Why enter a date into a textfield in the first place when there are nice easy date fields?
Friendly advice, use the proper field types to store your data, it will save you lots of headaches longterm

Format(date(), "YYYY")
Date is always today, which will always return 2013, so if you search for 2015 you will never find anything
 
namliam, thanks for the reply.

Sorry I didn't know there was another way to store date values other than using a textbox, which has been assigned as a date value. Can you please explain how and with what I should use instead of a textbox?

I can appreciate the Format(date(), "YYYY") statement returns today's date. I have removed this now from the default value in the textbox properties but still, this doesn't give me any replies from the query.

All I'm trying to do is enter a year (into a textbox) and the query returns all the [Expiredate] entry values for that year.

Mike
 
There is a date control that you can use instead...

Worse though is I assume you have your field in your table setup as a text as well, instead of a date field.

FYI. If you are going to use LIKE, you also need to use wildcards otherwize the like acts the same as an equals (=). Something along the lines of
Like "*" & [forms]![frmPrintOptions]![textbox29] & "*"
 

Users who are viewing this thread

Back
Top Bottom