save date in table

miketamp

Registered User.
Local time
Today, 14:04
Joined
Mar 30, 2005
Messages
22
Hi there...
I have a table which contains a field with the name "date". i have defined the property "date/time" on the data type of this field and as an input mask I have: “99/99/0000;0;_” i want the date to be saved as 02/02/2008 but every time I try to save it the zero digits are deleted and it is saved as 2/2/2008. How can I do that??
 
You shouldn't be viewing data in the table, you should use a form for that. Use the Format property in the form to control how it is displayed, rather than an input mask.
 
Hi,

I have a date field in one of my tables and used your input mask and it worked fine.

I entered 02/02/2008 and it saved as that, I entered your input mask as follows: 99/99/0000;0;_”

John
 
In addition, Date isn't the best name for a field as it's a reserved word in Access. I would suggest you make it more descriptive, if only for your own benefit. (i.e. DatePaid, DateReceived, etc.)
 
Or even using the Hungarian notation method for your table fields as follows:

dtm for all fields that are either date or time [i.e. dtmDate]
str for all fields that are of string type [i.e. strSurname]
lng for all fields that are of numerical type [i.e. lngAutoID]
ysn for all fields that are of Yes/No type [i.e. ysnNewStarterOffer]

This helps considerably with clearly identifying your field types in your tables particalary when it comes to building your queries and forms, but this is just my Preference, others may have a different method.

John
 
Hi,

I have a date field in one of my tables and used your input mask and it worked fine.

I entered 02/02/2008 and it saved as that, I entered your input mask as follows: 99/99/0000;0;_”

John

The input mask makes no difference here

With input mask and a date field

02/02/2008 converts to 2/02/2008

My date field will automatically change an entry of 02/02/08 to 2/02/2008 or change 2/2/08 to 2/02/2008

If I enter 2/23/08 it won't accept.

How can I enter the 23rd of February? Is the answer to be found in the Watercooler forum:D
 
Thank you all for the answers.
The problem was on the regional settings. In my table the date is correct now. But I still have a problem. I have a query to find all the records for a specific month. In the query there is an extra field “monthfind” which is hidden and in the criteria line I have this expression : month[(date field)] so when I run the query I have to input the number of the month. For example 02 for February. The problem is that if I press 02 is not working. If I press 2 is working. I tried to change the expression to month[(date field),”mm”] but I have a message for the comma. I thought that if I could change the date at the table as I ask you before it would work but the problem still exists.
Can anyone tell me what to do?
 

Users who are viewing this thread

Back
Top Bottom