Dates with code

  • Thread starter Thread starter 72185
  • Start date Start date
7

72185

Hello All!

I have a form where the date must be entered whenever the user records
an account. I have it set up with 3 drop down boxes. One for the
month, one for the day and one for the year. I know thats not the most
efficient way but I need it like that so I can search by month/year.

My problem is that the date they have to enter in the date one by one
and takes more time then needed. My question is, is there a way that I
can make it automatically display the date whenever the form is brought
up, and still be able to search by month/year. I know you can code the
date with now() but I don't think that is going to work in this case.

Thanks for your help,

-W
 
Hi "72185".

72185 said:
I have a form where the date must be entered whenever the user records
an account. I have it set up with 3 drop down boxes. One for the
month, one for the day and one for the year. I know thats not the most
efficient way but I need it like that so I can search by month/year.

My problem is that the date they have to enter in the date one by one
and takes more time then needed. My question is, is there a way that I
can make it automatically display the date whenever the form is brought
up, and still be able to search by month/year. I know you can code the
date with now() but I don't think that is going to work in this case.

You could use default values for the three comboboxes:
=Month(Date())
=Day(Date())
=Year(Date())
 
Hi Seven etc :)

I suggest a normal date field say, dtDate and a calculated search field in
a query asf:

srcDate:Format(Year([dtDate],"00") & Format(Month([dtDate],"00") &
Format(Day([dtDate],"00")

Sort on that field and put it in a combo box as the first column and a
visible dtDate column next to it and bingo

For clarity you can put spaces dot or whatever between the elements but that
would mean more key strokes when searching eg.
srcDate:Format(Year([dtDate],"00") & "." & Format(Month([dtDate],"00") &
"." & Format(Day([dtDate],"00")

Regard/JK
 
Hello All!

I have a form where the date must be entered whenever the user records
an account. I have it set up with 3 drop down boxes. One for the
month, one for the day and one for the year. I know thats not the most
efficient way but I need it like that so I can search by month/year.

My problem is that the date they have to enter in the date one by one
and takes more time then needed. My question is, is there a way that I
can make it automatically display the date whenever the form is brought
up, and still be able to search by month/year. I know you can code the
date with now() but I don't think that is going to work in this case.

Thanks for your help,

-W

Don't use the 3 drop-downs.
Add a DateField Date datatype to your table.
As default value on the field:
=Date()
All new records will automatically have the current date entered.

Then, whenever you need to return records of a particular month, as
criteria in a query:
Where Format(YourTable.[DateField],"mm/yyyy") = [Enter the Month and
year mm/yyyy]

Enter 05/2006 to get records for May of this year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top