A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Too few parameters expected 3



 
 
Thread Tools Display Modes
  #1  
Old May 7th, 2004, 11:38 PM
external usenet poster
 
Posts: n/a
Default Too few parameters expected 3

I get the above message when running the following code.
What is the problem?

Dim MyDb As Database, MySet As Recordset
Set MyDb = CurrentDb
Set MySet = MyDb.OpenRecordset("QueryAv")
MySet.Edit
MySet![Booking ID] = lngNext
MySet.Update
MySet.Close
Set MySet = Nothing

Thanks in advance.
  #2  
Old May 8th, 2004, 12:18 AM
PC Datasheet
external usenet poster
 
Posts: n/a
Default Too few parameters expected 3

QueryAv has three fields with criteria.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications

www.pcdatasheet.com


wrote in message
...
I get the above message when running the following code.
What is the problem?

Dim MyDb As Database, MySet As Recordset
Set MyDb = CurrentDb
Set MySet = MyDb.OpenRecordset("QueryAv")
MySet.Edit
MySet![Booking ID] = lngNext
MySet.Update
MySet.Close
Set MySet = Nothing

Thanks in advance.



  #3  
Old May 8th, 2004, 02:59 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Too few parameters expected 3

Must be a late start for the School assignment!

"Kate" has been asking about "QueryAv" about a week ago. Search Google for
Tina's answers to Kate's threads (she posted so many threads and I can find
them).

Here is my previous reply wich may / may not apply to your "QueryAv":

There are 3 Parameters that need to be resolved before passing the SQL
String to JET for processing. They a

Forms![SINGLE BOOKING AVAILABILITY]!BookingDate
Forms![SINGLE BOOKING AVAILABILITY]!Combo8
Forms![SINGLE BOOKING AVAILABILITY]!Combo10

Note that JET Database Engine which process the SQL String does not know
anything about Forms or Controls on Form so these need to be replaced with
actual values before passing the SQL String to JET for processing.

--
HTH
Van T. Dinh
MVP (Access)




wrote in message
...
I get the above message when running the following code.
What is the problem?

Dim MyDb As Database, MySet As Recordset
Set MyDb = CurrentDb
Set MySet = MyDb.OpenRecordset("QueryAv")
MySet.Edit
MySet![Booking ID] = lngNext
MySet.Update
MySet.Close
Set MySet = Nothing

Thanks in advance.



  #4  
Old May 8th, 2004, 03:54 PM
Joe Fallon
external usenet poster
 
Posts: n/a
Default Too few parameters expected 3

Access can figure out what the parameter is when the query is run in the
grid. Then Access will inform the Jet Engine what it is.

However, when the same query is run in code, you must tell the Jet engine
what the
parameter is yourself.

This is the slickest way to do it:

With queries that contain parameters that are all references to
controls on open forms, you can simulate the expression service that Access
provides when the queries are run through the user interface, as follows:

Set db = CurrentDb
Set qdf = db.QueryDefs("MyQuery")
Dim prm As Parameter

For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm

Set rs = qdf.OpenRecordset(dbOpenDynaset)
' or qdf.Execute dbFailOnError

--
Joe Fallon
Access MVP



wrote in message
...
I get the above message when running the following code.
What is the problem?

Dim MyDb As Database, MySet As Recordset
Set MyDb = CurrentDb
Set MySet = MyDb.OpenRecordset("QueryAv")
MySet.Edit
MySet![Booking ID] = lngNext
MySet.Update
MySet.Close
Set MySet = Nothing

Thanks in advance.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.