MCP_infiltrator
MCP_infiltrator

Reputation: 4179

Form validation rule MS-Access 2007

I have a simple form that gets used to enter information into a table. I want to use a validation rule on the form so that information gets entered correctly. I have a datetime object that must be filled out in a non-traditional form so I just want to check the length and make sure it is equal to 16. I have the following in the form which does not work

=Len([DISCHARGE DATETIME])=16

But when I put the same rule in the table and not in the form it works just fine, any ideas?

Upvotes: 1

Views: 219

Answers (1)

Fionnuala
Fionnuala

Reputation: 91316

Dates should be stored in date data types. In a lot of DBs the date data type is numeric. In MS Access it is a decimal, the integer portion is a date and the decimal a time. It is not difficult to create a query that uses the Format function to modify output to suit an application.

 SELECT Format(ThisDate,"yyyy-mm-dd hh:nn:ss") FROM ThisTable

Upvotes: 2

Related Questions