Now works, Date doesn't?

G

Guest

In a Rich Text memo field called Comments, I set the AfterUpdate event to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16 AM -

What date function do I use to get today's date? I have tried both Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I changed the
memo fields to Rich Text, that function doesn't work either. Can't I have
both Rich Text and Date?
 
G

Guest

Didn't work. Nothing was missing, but I followed your instructions and it
didn't change. I even unchecked one in the list completely closed, opened,
rechecked the list item completely closed and opened, but still no change.

I also can't do this with the same frontend on someone elses computer. Is
this date issue local to my install or to the database I'm currently in?

John W. Vinson said:
In a Rich Text memo field called Comments, I set the AfterUpdate event to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16 AM -

What date function do I use to get today's date? I have tried both Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I changed the
memo fields to Rich Text, that function doesn't work either. Can't I have
both Rich Text and Date?

This appears to be the very common References bug. It often kills the Date()
function while leaving Now() untouched. Open any module in design view, or
open the VBA editor by typing Ctrl-G. Select Tools... References from the
menu. One of the .DLL files required by Access will probably be marked
MISSING. Uncheck it, recheck it, close and open Access.

If none are MISSING, check any reference; close and open Access; then uncheck
it again. This will force Access to relink the libraries.
 
R

ruralguy via AccessMonster.com

Any chance you have used the name "Date" as a field name or a function
somewhere? That would be a No No.
In a Rich Text memo field called Comments, I set the AfterUpdate event to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16 AM -

What date function do I use to get today's date? I have tried both Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I changed the
memo fields to Rich Text, that function doesn't work either. Can't I have
both Rich Text and Date?
 
G

Guest

No, I definately don't have Date used as a field name, thanks though.

I don't know if this will help, but I am going to uninstall and reinstall my
Office 07 suite because I have issues elsewhere too, not just Access. If that
doesn't fix my date issue, I'll be back here looking for other solutions.

Here is another somewhat related question: I have a split DB and I do 95% of
the programming from my computer. However the DB doesn't seem to be
completely stable. It works for a while, usually a long time, then all of a
sudden a dropdown will be blank on one person's computer, but not anyone
elses. Or sometimes a concatenated field (first and last) will show as #Name,
but if I open the query the form is designed on, requery and close, it will
work; I don't change anything. If I have problems resulting from a bad
install of Office/Access could the splits be picking something up from me and
not work properly on others' computers?

I hope that was clear.

ruralguy via AccessMonster.com said:
Any chance you have used the name "Date" as a field name or a function
somewhere? That would be a No No.
In a Rich Text memo field called Comments, I set the AfterUpdate event to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16 AM -

What date function do I use to get today's date? I have tried both Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I changed the
memo fields to Rich Text, that function doesn't work either. Can't I have
both Rich Text and Date?
 
G

Guest

OK, reinstall didn't help :-(

Another thing that happens is I can't save an import - the error says
"project not found" (real helpful, I know) that is what made me think I had a
bad install, but I still get that error after the reinstall.

Anymore ideas??

AllYourSpam said:
No, I definately don't have Date used as a field name, thanks though.

I don't know if this will help, but I am going to uninstall and reinstall my
Office 07 suite because I have issues elsewhere too, not just Access. If that
doesn't fix my date issue, I'll be back here looking for other solutions.

Here is another somewhat related question: I have a split DB and I do 95% of
the programming from my computer. However the DB doesn't seem to be
completely stable. It works for a while, usually a long time, then all of a
sudden a dropdown will be blank on one person's computer, but not anyone
elses. Or sometimes a concatenated field (first and last) will show as #Name,
but if I open the query the form is designed on, requery and close, it will
work; I don't change anything. If I have problems resulting from a bad
install of Office/Access could the splits be picking something up from me and
not work properly on others' computers?

I hope that was clear.

ruralguy via AccessMonster.com said:
Any chance you have used the name "Date" as a field name or a function
somewhere? That would be a No No.
In a Rich Text memo field called Comments, I set the AfterUpdate event to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16 AM -

What date function do I use to get today's date? I have tried both Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I changed the
memo fields to Rich Text, that function doesn't work either. Can't I have
both Rich Text and Date?
 
G

Guest

If the memo field is set for Rich Text, the shortcut of Control Semicolon
does not work - it somehow gets disabled, so the answer to my question "Can't
I have
both Rich Text and Date?" the answer seems to be NO.
 
L

Linq Adams via AccessMonster.com

What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]
 
J

John W. Vinson

What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]

Or just

Me.Comments = Format(Date("mm/dd/yyyy") & " - " & Me.Comments
 
D

Douglas J. Steele

It's likely a References problem.

See whether VBA.Date works for you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


AllYourSpam said:
OK, reinstall didn't help :-(

Another thing that happens is I can't save an import - the error says
"project not found" (real helpful, I know) that is what made me think I
had a
bad install, but I still get that error after the reinstall.

Anymore ideas??

AllYourSpam said:
No, I definately don't have Date used as a field name, thanks though.

I don't know if this will help, but I am going to uninstall and reinstall
my
Office 07 suite because I have issues elsewhere too, not just Access. If
that
doesn't fix my date issue, I'll be back here looking for other solutions.

Here is another somewhat related question: I have a split DB and I do 95%
of
the programming from my computer. However the DB doesn't seem to be
completely stable. It works for a while, usually a long time, then all of
a
sudden a dropdown will be blank on one person's computer, but not anyone
elses. Or sometimes a concatenated field (first and last) will show as
#Name,
but if I open the query the form is designed on, requery and close, it
will
work; I don't change anything. If I have problems resulting from a bad
install of Office/Access could the splits be picking something up from me
and
not work properly on others' computers?

I hope that was clear.

ruralguy via AccessMonster.com said:
Any chance you have used the name "Date" as a field name or a function
somewhere? That would be a No No.

AllYourSpam wrote:
In a Rich Text memo field called Comments, I set the AfterUpdate event
to
Me.Comments = Date & " - " & [Comments]
This does not work; the result is a space dash space then my comments.
However if I use Now instead of Date the result is 4/30/2009 11:18:16
AM -

What date function do I use to get today's date? I have tried both
Date()
and Date, neither work.

BTW, We used to use the Ctrl: to auto enter the date but since I
changed the
memo fields to Rich Text, that function doesn't work either. Can't I
have
both Rich Text and Date?
 
G

Guest

Thank you. Thank you to all!
Here is what happened, because I tried each solution -

Adams: Did not work - the field froze and could not be updated.
Vinson: Did not work at all. The code turned red with a syntax error
Steele: Worked but in a Rich Text format it adds a return so comments move
to the next line down.

I am convinced there is something wrong with my computer (see my earlier
comments on this post) because today, the date function works properly!

After all this, I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Has anyone else had this situation? Or is it my computer? If it is not my
computer, can it be fixed - can the shortcut be used with Rich Text?


John W. Vinson said:
What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]

Or just

Me.Comments = Format(Date("mm/dd/yyyy") & " - " & Me.Comments
 
J

Jack Leach

Not trying to insinuate that you don't know what you're doing, but how well
normalized is your database, and what precautions have you taken against the
various forms of possible corruption?

The reason I ask is because there seems to be a much larger problem at hand.
If you're experience various non-related problems at random intervals across
random machines, that is (to me anyway) a sign that something's not right
with the db.

I wouldn't expect this to be a problem with the PC... unless maybe you make
a regular habit of trying to relocate dll's and expirement with the registry,
this seems to be application related. I can't think of any other way that
the PC might be invloved. And if you're experiencing difficulties
unexplainable difficulties on other computers as well...

If by chance you have not gone through the required steps to minimize the
possibilities of corruption and would like some info on where to look, post
back and I'll dig up some of the mvp webpages for dealing with this.

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



AllYourSpam said:
Thank you. Thank you to all!
Here is what happened, because I tried each solution -

Adams: Did not work - the field froze and could not be updated.
Vinson: Did not work at all. The code turned red with a syntax error
Steele: Worked but in a Rich Text format it adds a return so comments move
to the next line down.

I am convinced there is something wrong with my computer (see my earlier
comments on this post) because today, the date function works properly!

After all this, I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Has anyone else had this situation? Or is it my computer? If it is not my
computer, can it be fixed - can the shortcut be used with Rich Text?


John W. Vinson said:
What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]

Or just

Me.Comments = Format(Date("mm/dd/yyyy") & " - " & Me.Comments
 
J

Jack Leach

I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Have you considered a small 'Today' button on the side of your memo control
that will add the date for you? Something like...

Private Sub btnToday_Click()
Me.MemoField.SetFocus
Me.MemoField.Text = Me.MemoField.Text & " " & Date()
End Sub

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



AllYourSpam said:
Thank you. Thank you to all!
Here is what happened, because I tried each solution -

Adams: Did not work - the field froze and could not be updated.
Vinson: Did not work at all. The code turned red with a syntax error
Steele: Worked but in a Rich Text format it adds a return so comments move
to the next line down.

I am convinced there is something wrong with my computer (see my earlier
comments on this post) because today, the date function works properly!

After all this, I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Has anyone else had this situation? Or is it my computer? If it is not my
computer, can it be fixed - can the shortcut be used with Rich Text?


John W. Vinson said:
What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]

Or just

Me.Comments = Format(Date("mm/dd/yyyy") & " - " & Me.Comments
 
G

Guest

Sorry it has taken a few days to get back.

Insinuate away, the truth is the truth. I am a low intermediate level
designer/user in Access but I have a great understanding of the basics and
years of experience in FileMaker, even from when they were Claris (but that’s
probably not saying much). I inherited the database we work in, and it is
definitely NOT properly normalized. I have fixed as much as I can without it
being totally unstable. For as bad as it is, I can’t believe how much we can
actually make it do!
I have been churning on version 2 for a while but database work is only
1/10th of my duties, and I don’t get the focus time required to design and
test a new version.

The only time I have ever made changes to a dll file was when I tried to add
a Redemption file so Access could better utilize Outlook. Honestly, that was
the worst mistake I made, I have had nothing but problems since. As of today
I have a new computer, so maybe that will help.

Regarding minimizing corruption, after reading many different entries on
this and other forums, I have done some things, like turning off Name
AutoCorrect, prevent auto indexes, compact & repair on close, etc, but if you
have a recommended list I am always open; call me student, Mr. Meogy. All
help is appreciated.

I have not thought about a date button, I’ll see about incorporating your
suggestion.

Thanks
CAS


Jack Leach said:
I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Have you considered a small 'Today' button on the side of your memo control
that will add the date for you? Something like...

Private Sub btnToday_Click()
Me.MemoField.SetFocus
Me.MemoField.Text = Me.MemoField.Text & " " & Date()
End Sub

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



AllYourSpam said:
Thank you. Thank you to all!
Here is what happened, because I tried each solution -

Adams: Did not work - the field froze and could not be updated.
Vinson: Did not work at all. The code turned red with a syntax error
Steele: Worked but in a Rich Text format it adds a return so comments move
to the next line down.

I am convinced there is something wrong with my computer (see my earlier
comments on this post) because today, the date function works properly!

After all this, I guess what I'd really like is to have Rich Text format and
still use the date shortcut (Ctrl;), but I have not been able to use them
together.

Has anyone else had this situation? Or is it my computer? If it is not my
computer, can it be fixed - can the shortcut be used with Rich Text?


John W. Vinson said:
On Fri, 01 May 2009 01:18:57 GMT, "Linq Adams via AccessMonster.com"

What happens if you try using

Me.Comments = DatePart("m",Now)& "/" & DatePart("d",Now) & "/" & DatePart
("yyyy",Now) & " - " & [Comments]

Or just

Me.Comments = Format(Date("mm/dd/yyyy") & " - " & Me.Comments
 
J

John W. Vinson

Thank you. Thank you to all!
Here is what happened, because I tried each solution -

Adams: Did not work - the field froze and could not be updated.
Vinson: Did not work at all. The code turned red with a syntax error

Sorry; typo on my part, should have been

Me.Comments = Format(Date(), "mm/dd/yyyy") & " - " & Me.Comments
 
R

ruralguy via AccessMonster.com

John,
You've got a ping in the MVP group.
Sorry; typo on my part, should have been

Me.Comments = Format(Date(), "mm/dd/yyyy") & " - " & Me.Comments
 
H

Helen

I had the same problem, that Now() worked, but Date() didn't.

Now() returns a number. The integer part is the date, the decimal part is
the time, so Int(Now()) is exactly the same as Date()!!! Easy. :)
 
J

John W. Vinson

I had the same problem, that Now() worked, but Date() didn't.

Now() returns a number. The integer part is the date, the decimal part is
the time, so Int(Now()) is exactly the same as Date()!!! Easy. :)

Sure, you can get around the problem. It's better to fix it though!

Date() will fail if you have a missing Reference (VBA Editor... Tools...
References, look for one that is marked MISSING); it can also fail if you have
a table field or a form control named Date. Fix those problems and you won't
need the getaround.
 

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

Top