Hi Lasse,
Too Few Parameters normally result in
"...You receive the error message if you do not set the values of all the
parameters in the parameter query in Visual Basic for Applications..."
source:
http://support.microsoft.com/default.aspx?scid=kb;en-us;209203
Here's what you are probably seeing:
CurrentDb.Execute "some SQL Syntax with a Where clause and not an
existing query"
(note: the above includes the parameters -- works!!!)
CurrentDb.Execute "existing Update Query with parameters"
(note: the above fails with Too Few Parameters because the
parameters are not passed)
If you are using an existing query with parameters then do the following
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("the name of your existing query")
qdf![the parameter in the query] = "some value"
qdf.Execute
Eric
--------------------
| From: "Lasse T" <
[email protected]>
| Newsgroups: microsoft.public.access.queries
| Subject: Re: Update query and filter by selection
| Date: Mon, 2 Feb 2004 18:29:41 +0100
| Lines: 89
| Message-ID: <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| NNTP-Posting-Host: 213.150.141.235
| X-Trace: news.uni-berlin.de 1075742833 31671872 213.150.141.235 ([219006])
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfe
ed.freenet.de!fu-berlin.de!uni-berlin.de!213.150.141.235!not-for-mail
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.queries:188416
| X-Tomcat-NG: microsoft.public.access.queries
|
| Hi and thank you for your answer.
| I get exatly the same result with this code as you see in my other post in
| this conversation.
| Error "3061"
| Too few parameters 1 is expected. (translation from swedish)
| If I use the debug funktion and paste the result into a new query the
query
| works.
|
| Lasse T
| --------------
|
| ""prabha"" <
[email protected]> skrev i meddelandet
| | > Hi Lasse,
| >
| > You would need to use VBA code to do something like that, example:
| >
| > Private sub command1_click
| >
| > Currentdb.Execute "UPDATE Table1 SET Table1.Field = 'test' WHERE "
&
| > Me.Filter & ";"
| >
| > End Sub
| >
| > I hope this helps! If you have additional questions on this topic,
please
| > respond back to this posting.
| >
| >
| > Regards,
| >
| > Eric Butts
| > Microsoft Access Support
| >
| > "Microsoft Security Announcement: Have you installed the patch for
| > Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
| > you to review the information at the following link regarding Microsoft
| > Security Bulletin MS03-026
| > <
http://www.microsoft.com/security/security_bulletins/ms03-026.asp>
and/or
| > to visit Windows Update at <
http://windowsupdate.microsoft.com/> to
| install
| > the patch. Running the SCAN program from the Windows Update site will
| help
| > to insure you are current with all security patches, not just MS03-026."
| >
| >
| >
| > --------------------
| > | From: "Lasse T" <
[email protected]>
| > | Newsgroups: microsoft.public.access.queries
| > | Subject: Update query and filter by selection
| > | Date: Sun, 1 Feb 2004 13:14:04 +0100
| > | Lines: 15
| > | Message-ID: <
[email protected]>
| > | NNTP-Posting-Host: 213.150.141.235
| > | X-Trace: news.uni-berlin.de 1075637500 30526256 213.150.141.235
| ([219006])
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Path:
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
|
l.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin
| > de!213.150.141.235!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl microsoft.public.access.queries:188345
| > | X-Tomcat-NG: microsoft.public.access.queries
| > |
| > | Hi !
| > |
| > | I´m using filter by selection in a form. When I have filtered out any
| > | unwanted data i want to run an update query that updates one field
based
| > on
| > | a text box in the form.
| > | In other words. How do I "pick up" the current filter from the form
and
| > | apply the same filter in the update query.
| > |
| > | Thanks in advance
| > |
| > | Lasse T
| > | -------------
| > |
| > |
| > |
| > |
| >
|
|
|