Please help!

joce

Registered User.
Local time
Yesterday, 18:41
Joined
Oct 27, 2011
Messages
43
Hi,

I am trying to incorporate dates into my database but it is driving me mad. I cant get anything to work.

I am making a database that will be used for audits and what i want is to go in and enter in the customer name and the date once, at the top of the page then work my way through all the forms I have in tab control.

I cant get the date to enter in or function correctly, so that once it is entered in, the records made to all the forms that day, are recorded as that date to.

Pleaseeee someone help
 
Hi Joce.

I have put together an example of some code that could help you to do what I think you are after.

I hope this helps.
 

Attachments

Hi Joce.

I have put together an example of some code that could help you to do what I think you are after.

I hope this helps.

Nice demo, I personally dislike using =Now() in my tables because it adds the time. When you throw criteria against it gets all muddled up.

' Put today's date in defaultDate
Me.defaultDate = Now()
End Sub
 
Nice demo, I personally dislike using =Now() in my tables because it adds the time. When you throw criteria against it gets all muddled up.

' Put today's date in defaultDate
Me.defaultDate = Now()
End Sub

Did you not mean;
Code:
' Put today's date in defaultDate
Me.defaultDate = Date()
End Sub
 
What exactly do you mean by muddled? I have an issue with a project where now() plus a time zone adjustment is stored. When I query that data for like date() & *, it seems flakey. Is this what your talking about? I haven't tackled the issue yet, but I was planning on storing now and date, and modifying the query to only look at date(). The fact that I am adjusting for time zone complicates it further, but I think its doable.
 
One reason:
searching for records using Date() when the field is storing the
Date and Time or using Now() could cause incorrect
records to be returned. I like to store my dates in =Date() and times in =Time().
 
Yes, Me.defaultDate = Date() would be better in this case. :)

I think I may have misinterpreted the original post. :confused:

What seems to be required is to use Today's date in all the records entered on that day.

I thought the operator would be entering a date from a form and entering the same recorded date batch by batch.


If it is a matter of just entering Today's date on each record by default I would just make the "Default value" property (in table design view) of the appropriate field Date() instead.

(K)eep (I)t (S)imple (S)tupid.


Mind you, if you made the "Default value" property of the field Now() it would tell you when the record was entered.
 
Last edited:
By making date the default value in each of my many tables which I have, will they all link together? Or must I do somthing else. Currently all the tables are linked together by customer ID just.

Say for example I had 5 groups of cows, each group has their own table, and i have taken a body condition score sample from each group e.g. on a scale of 1-5, and now I want to combine the results which I got from each group on that one day

therefore, it will look as follows:

Date Group 1 Group 2 Group 3 Group 4
17/11/11 2 3 1 2


Above is what I am trying to achieve
 
sorry above what I was trying to show has got messed up, date, group 1, group 2, group3 and group 4 where all ment to appear like colums, with the values below them
 
It can be useful to have a date updated field in many forms.

Similar to the default value what I tend to do in this is create a date updated field in whatever table I'm interested then

In the Before Update Event of the FORM

Me.DateUpdated = Date()

If there are any changes on the form this field will be updated with the date of alteration. If No alterations are made viewing the form will not change this value.
 
You could also use the Before Insert Event of the Form

Me.DateEntered = Date() [Or what ever the field name you use]

Today's date would get entered automatically as the record is created.
 

Users who are viewing this thread

Back
Top Bottom