I want the Date() Now()

chuckster

Registered User.
Local time
Today, 13:20
Joined
Oct 4, 2000
Messages
52
If I set the Default Field in the Table to -Date() each new field comes up nicely with a date (no time etc) which is what I want.

If however I want it to be based on an event eg Clicking a tick box VBA doesn't like Date() and I have to use Now().

eg
On CLick

me.field = Now()

Is there any way of using date or can I fill in some parameters in Now(dmyyyy) or something that will make the field only a date field with no time information.

I know I can set the control's format but I want to be able to filter these fields by date easily.

Thanks
 
Me.FieldName = Date

should work for you. Access gets rid of the parenthesis and the code look just like it does above.
 
You say that "VBA doesn't like Date()". If the Date() function does not return the current date, then you more than likely have a library reference problem in your app.

RDH
 
I think Mr Hicks has it. Do I need to import or install the function or something?
Or do I have to declare a varible or something?

Error I get.

Expected variable or Procedure not in Project.
 
What you need to do is check the library references.

To do this, open any module in design view, Choose Tools/References from Access main menu. Look for a checked library with "Missing" attached to it. Should you find one, uncheck it, this should fix the problem. Should the library be needed in the app, you will need to place the needed files in correct folder and properly register the control in Access. This problem is commonly caused by a non-standard ActiveX control being inserted into the app that is not included on the machine giving the error. Even if the control was removed, the reference will remain, thus causing the problem.

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom