Date() function and Notice when sending email

L

Linda

Hi,

I have used the DATE() as my default value, however when I go to run the
form, it returns #Name? in that text field. I have looked at all the
possible problems that may cause this and can not figure it out.
Also, when sending an email from my form, it comes up with a Microsoft
Outlook message box stating "A program is trying to automatically send e-mail
on your behalf. Do you want to allow this? If this is unexpected, it may
be a virus and you should choose No" it gives you the option Yes No or Help.
Is there any way to not have this message come up?

Any suggestions?

Thanks
Linda
 
S

Stockwell43

Hi Linda,

The Date thing is that Access is not recognizing a field name so either
there isn't one or you may have it spelled incorrectly. Where exactly are you
putting the Date() anyway and how is it pulling the date?

As far as your email, I assume your using a button that when clicked pulls
the email up (or that's how you want it to work) correct? Are you using a
Macro or VBA coding to do this?

There is a SendObject macro that will work for emailing from a form. That is
the most simplest basic way. If you are looking to customize the email you
will need to code it.

Hope this helps!
 
L

Linda

I put the it in a text box under the Data properties tab in Default value and
the input mask is 99\->L<LL\-00;0;_. My control source is DATE.

And as for the Email thing this is my code:
Private Sub Command77_Click()
Dim refnum As Long
refnum = RPRTNUM
DoCmd.SendObject acSendNoObject, , , "(e-mail address removed)", , , "Report
Request", "The report number is " & refnum & ".", False
End Sub
 
S

Stockwell43

I found this code on the internet some time ago and works well for me but
maybe you can manipulate it for your use. For the Message part, I have it
pulling the information from those field of the current record.

On Error GoTo EH
Dim SendTo As String, SendCC As String, MySubject As String, MyMessage
As String
SendTo = ""
SendCC = "(e-mail address removed), (e-mail address removed)"

MySubject = "Additional Information Needed"
MyMessage = Me.LoanNumber & vbCr & Me.CustomerFirst & " " &
Me.CustomerLast & vbCr & Me.ErrorCode & _
vbCr & Me.Comments
DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject,
MyMessage, True

EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been
cancelled."
End If

As far as the Date thing, in your table try changing the name of the field
from DATE to CurrentDate. Sometimes access recognizes names simlar to
commands and gets confused.
 
L

Linda

Is there any code or property I can use to tell it to ignore all messages?

Also, I changed the field in my table to CURRDATE and still get that error.
I also tried using the inser Date/Time feature and I get the same thing in
the text field #Name?
 
S

Stockwell43

If you don't want the OnMessage part of it just put ' in front of On. This
will turn it green and disable that part of the code.

As for the date. Go on the All tab in your Properties of the date textbox.
Make sure your Name and Control Source are CURRDATE and it should recognize
it.

Are you looking for the current date to automatically appear when the form
is opened and that is why you have that field as your default? Or are your
user still having to manually input the date in the field?
 
L

Linda

Where is the OnMessage part?

Also, I tried the having the same name for both properties, it did not work.
Do you think it has anything to do with this coding I have for Calendar
(it's for another field)
Private Sub duedate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
cal.Visible = True
cal.SetFocus

If Not IsNull(duedate) Then
cal.Value = duedate.Value
Else
cal.Value = DATE
End If
End Sub
 
S

Stockwell43

I'm sorry, that was a typo on my part. Put the ' before MyMessage =
Me.LoanNumber & vbCr & Me.CustomerFirst & " " etc.....

It could have something to do with the calander because the way I gave it to
you should worked. I never worked with a calander before so if you have that
in your form I can't help much. Maybe try taking DATE out of your default
value and see what happens. It should be set on your table as a Date/Time
anyway. If that doesn't work, I would try to posting it again and add all the
information about the calander and code that you put here and post it to the
Forms Coding group. Sorry I wasn't able to help more.
 

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