Too Few Parameters......can't find form

J

JNariss

Hello,

I have a form in my database called "Approval Form". When someone fills
out the form and clicks submit it uses the SendObject command to send
an email notifying someone that the form has been filled out.

On that form is a # called Request ID. This number is originally in my
table called Request. I am trying to use a recordset to populate my
email with the specific Request ID so the person who receives the email
knows which Request ID has been Approved.

I first received the error 3601 Too few parameters. Expected 1 and now
I am receiving some error telling me: can't find form 'Approval_Form'
referred to in a macro expression or Visual Basic code.

I have no idea what to do now. The code I am using is:

Private Sub Submit_Approval_Click()
Dim strTo As String
Dim strRequest_ID As String
Dim strMessage As String
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * From Request WHERE [Request_ID]" &
" = " & Forms!Approval_Form!Request_ID & ";")

strRequest = rst![Request_ID]
strTo = "(e-mail address removed)"


strMessage = "You have been choosen as the Analyst for a System Change
Request. Please go to the database at
\\egsrosintra1\d$\Database\SystemChangeRequest.mdb and choose Reports -
View By --> View By Request ID" & Chr$(13) & Chr$(13) & _
"Request ID: " & strRequest & Chr$(13) & Chr$(13) & _
"Please do not reply to this automated email."

DoCmd.SendObject acSendNoObject, , , strTo, , , "Analyst Assigned",
strMessage, No, False
DoCmd.Close acForm, "Approval Form", acSaveYes
MsgBox "You have notified the Analyst that he/she has been assigned to
a Request and to go to the database to view it.", vbOKOnly, "Analyst
Assigned"
End Sub


If anyone knows how I can fix this I would truly appreciate it.

Thanks,
Justine
 
G

Guest

I am going to assume you are using code and not a macro. If this is the case
check the complete spelling of the form to find any differences in the two
locations. A white space cannot be represented by a _.
 
J

JNariss

Thanks for the quick reply.

My form is called "Approval Form" so how would I represent the white
space? Or should I just rename the form to "Approval"?

Other than this being the problem.....does the rest of the code look
good?
 
R

RoyVidar

(e-mail address removed) wrote in message
Thanks for the quick reply.

My form is called "Approval Form" so how would I represent the white
space? Or should I just rename the form to "Approval"?

Other than this being the problem.....does the rest of the code look
good?

Is the same so also for the field?

Either use [brackets]

Forms![Approval Form]![Request ID]

of the parentheses/quotes style

Forms("Approval Form").Controls("Request ID")

But do consider a naming convention avoiding spaces and special
characters for your next project.

Rest looks OK by a quick glance (no need for the & ";", though, at the
end of the sql statement)
 
J

JNariss

Your the best Roy..........I will definately do a naming convention
next time - this project has taught me a lot. I almost feel like an
Access Pro. hahaha

I will try the examples you have given to me and hope they work.

-Justine
 

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