Please tell me what I am doing wrong - DAO parameter Append Query :( 
Author Message
 Please tell me what I am doing wrong - DAO parameter Append Query :(

Help!

Can someone tell me what is wrong with this code?  I'm using Acc2000.

- Everytime i run it i get "Too few parameters. Expecting 1".

yet, I have defined the parameters, i've checked the query six billions
times, the parameter is there in the query grid, as well as in the
Parameters box in the Query properties.  The spelling is exactly the same as
I have below "PolicyID".  The data type is long integer, not problems there.

I have run this query perfectly using the QBE grid, and supplying my own
parameter at run time by typing in the value.  That works OK.
But it will NOT work in code.

******* CODE SNIPPET START ************

Dim dbs as DAO.Database
Set dbs = CurrentDB()

Dim qdfCommPayouts As DAO.QueryDef
Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error - too few
params

dbs.Execute "appztblTEMP_PolicyCommPayouts"

**** CODE SNIPPET END *********

Someone please tell me what i'm doing wrong?

Thanks!

Edward Grainger



Mon, 03 Feb 2003 14:46:28 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
See
http://www.mvps.org/access/queries/qry0013.htm
Joan

Quote:
> Help!

> Can someone tell me what is wrong with this code?  I'm using Acc2000.

> - Everytime i run it i get "Too few parameters. Expecting 1".

> yet, I have defined the parameters, i've checked the query six billions
> times, the parameter is there in the query grid, as well as in the
> Parameters box in the Query properties.  The spelling is exactly the same
as
> I have below "PolicyID".  The data type is long integer, not problems
there.

> I have run this query perfectly using the QBE grid, and supplying my own
> parameter at run time by typing in the value.  That works OK.
> But it will NOT work in code.

> ******* CODE SNIPPET START ************

> Dim dbs as DAO.Database
> Set dbs = CurrentDB()

> Dim qdfCommPayouts As DAO.QueryDef
> Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error - too
few
> params

> dbs.Execute "appztblTEMP_PolicyCommPayouts"

> **** CODE SNIPPET END *********

> Someone please tell me what i'm doing wrong?

> Thanks!

> Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
Joan:

I have already looked at that article and many others and my code as you can
see below seems to be correct according to anything i've looked at, yet the
parameters are never accepted!

THanks for the tip, but do you have any comments on my code snippet below?

Edward Grainger

Quote:


> > Help!

> > Can someone tell me what is wrong with this code?  I'm using Acc2000.

> > - Everytime i run it i get "Too few parameters. Expecting 1".

> > yet, I have defined the parameters, i've checked the query six billions
> > times, the parameter is there in the query grid, as well as in the
> > Parameters box in the Query properties.  The spelling is exactly the
same
> as
> > I have below "PolicyID".  The data type is long integer, not problems
> there.

> > I have run this query perfectly using the QBE grid, and supplying my own
> > parameter at run time by typing in the value.  That works OK.
> > But it will NOT work in code.

> > ******* CODE SNIPPET START ************

> > Dim dbs as DAO.Database
> > Set dbs = CurrentDB()

> > Dim qdfCommPayouts As DAO.QueryDef
> > Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> > qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error - too
> few
> > params

> > dbs.Execute "appztblTEMP_PolicyCommPayouts"

> > **** CODE SNIPPET END *********

> > Someone please tell me what i'm doing wrong?

> > Thanks!

> > Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(

(I originally posted this early this morning, but the date on my home
machine was messed up so you may not have seen it)

Shouldn't that last line:

    >dbs.Execute "appztblTEMP_PolicyCommPayouts"

be

    qdfCommPayouts.Execute

?
--

Dirk Goldgar
(remove NOSPAM from reply address)


Quote:
> Help!

> Can someone tell me what is wrong with this code?  I'm using Acc2000.

> - Everytime i run it i get "Too few parameters. Expecting 1".

> yet, I have defined the parameters, i've checked the query six billions
> times, the parameter is there in the query grid, as well as in the
> Parameters box in the Query properties.  The spelling is exactly the same
as
> I have below "PolicyID".  The data type is long integer, not problems
there.

> I have run this query perfectly using the QBE grid, and supplying my own
> parameter at run time by typing in the value.  That works OK.
> But it will NOT work in code.

> ******* CODE SNIPPET START ************

> Dim dbs as DAO.Database
> Set dbs = CurrentDB()

> Dim qdfCommPayouts As DAO.QueryDef
> Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error - too
few
> params

> dbs.Execute "appztblTEMP_PolicyCommPayouts"

> **** CODE SNIPPET END *********

> Someone please tell me what i'm doing wrong?

> Thanks!

> Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
What is lngBFGPolicyID ?  I don't see it defined in your code.  Is it a
control on an open form?
Joan

Quote:
> Joan:

> I have already looked at that article and many others and my code as you
can
> see below seems to be correct according to anything i've looked at, yet
the
> parameters are never accepted!

> THanks for the tip, but do you have any comments on my code snippet below?

> Edward Grainger



> > > Help!

> > > Can someone tell me what is wrong with this code?  I'm using Acc2000.

> > > - Everytime i run it i get "Too few parameters. Expecting 1".

> > > yet, I have defined the parameters, i've checked the query six
billions
> > > times, the parameter is there in the query grid, as well as in the
> > > Parameters box in the Query properties.  The spelling is exactly the
> same
> > as
> > > I have below "PolicyID".  The data type is long integer, not problems
> > there.

> > > I have run this query perfectly using the QBE grid, and supplying my
own
> > > parameter at run time by typing in the value.  That works OK.
> > > But it will NOT work in code.

> > > ******* CODE SNIPPET START ************

> > > Dim dbs as DAO.Database
> > > Set dbs = CurrentDB()

> > > Dim qdfCommPayouts As DAO.QueryDef
> > > Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> > > qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error -
too
> > few
> > > params

> > > dbs.Execute "appztblTEMP_PolicyCommPayouts"

> > > **** CODE SNIPPET END *********

> > > Someone please tell me what i'm doing wrong?

> > > Thanks!

> > > Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
Sorry, lngBFGPolicyID is a long integer variable that's already been defined
in the module and holds the current value of the parameter that my append
query needs to run.

Regards

Edward Grainger


Quote:
> What is lngBFGPolicyID ?  I don't see it defined in your code.  Is it a
> control on an open form?
> Joan


> > Joan:

> > I have already looked at that article and many others and my code as you
> can
> > see below seems to be correct according to anything i've looked at, yet
> the
> > parameters are never accepted!

> > THanks for the tip, but do you have any comments on my code snippet
below?

> > Edward Grainger



> > > > Help!

> > > > Can someone tell me what is wrong with this code?  I'm using
Acc2000.

> > > > - Everytime i run it i get "Too few parameters. Expecting 1".

> > > > yet, I have defined the parameters, i've checked the query six
> billions
> > > > times, the parameter is there in the query grid, as well as in the
> > > > Parameters box in the Query properties.  The spelling is exactly the
> > same
> > > as
> > > > I have below "PolicyID".  The data type is long integer, not
problems
> > > there.

> > > > I have run this query perfectly using the QBE grid, and supplying my
> own
> > > > parameter at run time by typing in the value.  That works OK.
> > > > But it will NOT work in code.

> > > > ******* CODE SNIPPET START ************

> > > > Dim dbs as DAO.Database
> > > > Set dbs = CurrentDB()

> > > > Dim qdfCommPayouts As DAO.QueryDef
> > > > Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> > > > qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error -
> too
> > > few
> > > > params

> > > > dbs.Execute "appztblTEMP_PolicyCommPayouts"

> > > > **** CODE SNIPPET END *********

> > > > Someone please tell me what i'm doing wrong?

> > > > Thanks!

> > > > Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
Dirk:

You are correct! - i've seen it done both ways, i tried it first using
qdf.Execute and it didn't work, so i switched to dbs.Execute "qdfWhatever"
and that didn't work.

NOW IT WORKS using qdf.Execute.  THANK YOU SO MUCH for reminding me to
change that back - i knew it had to be something simple...you know when you
start swearing at your computer you've got to 'step back' from the situation
and look at it after a night's sleep!

Thanks again.

Edward Grainger


Quote:

> (I originally posted this early this morning, but the date on my home
> machine was messed up so you may not have seen it)

> Shouldn't that last line:

>     >dbs.Execute "appztblTEMP_PolicyCommPayouts"

> be

>     qdfCommPayouts.Execute

> ?
> --

> Dirk Goldgar
> (remove NOSPAM from reply address)



> > Help!

> > Can someone tell me what is wrong with this code?  I'm using Acc2000.

> > - Everytime i run it i get "Too few parameters. Expecting 1".

> > yet, I have defined the parameters, i've checked the query six billions
> > times, the parameter is there in the query grid, as well as in the
> > Parameters box in the Query properties.  The spelling is exactly the
same
> as
> > I have below "PolicyID".  The data type is long integer, not problems
> there.

> > I have run this query perfectly using the QBE grid, and supplying my own
> > parameter at run time by typing in the value.  That works OK.
> > But it will NOT work in code.

> > ******* CODE SNIPPET START ************

> > Dim dbs as DAO.Database
> > Set dbs = CurrentDB()

> > Dim qdfCommPayouts As DAO.QueryDef
> > Set qdfCommPayouts = dbs.QueryDefs("appztblTEMP_PolicyCommPayouts")
> > qdfCommPayouts.Parameters("PolicyID") = lngBFGPolicyID   <<'Error - too
> few
> > params

> > dbs.Execute "appztblTEMP_PolicyCommPayouts"

> > **** CODE SNIPPET END *********

> > Someone please tell me what i'm doing wrong?

> > Thanks!

> > Edward Grainger



Mon, 03 Feb 2003 03:00:00 GMT  
 Please tell me what I am doing wrong - DAO parameter Append Query :(
Well, when I saw your message appear at almost 3 in the morning Eastern
time, I knew you were having one of those days.
--

Dirk Goldgar
(remove NOSPAM from reply address)


Quote:
> you know when you
> start swearing at your computer you've got to 'step back' from the
situation
> and look at it after a night's sleep!



Mon, 03 Feb 2003 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Will somebody tell me what I am doing wrong with this ListView Control

2. tell another program i am done

3. Recordset: What am I doing wrong?

4. What am I doing wrong??

5. What am I doing wrong?

6. Help with syntax. What am I doing wrong

7. What am I doing wrong?

8. What am I doing wrong?

9. What am I doing wrong? -MultiSelect List box

10. Select Case - What am I doing wrong?

11. What am I doing wrong (easy).

12. OLE problem, or what am I doing wrong?

 

 
Powered by phpBB® Forum Software