473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Parameters in QryDef in Acc2000

Hi all
I'm converting a db from Acc97 to 2000. Everything works, except assigning
of a qdf object containing parameters, to a recordset.

The db, recordset, and qrydef objects are all referenced as DAO objects, and
the reference to dao 3.6 is present and working.
The code breaks at the last statement (below) with an 'invalid arguament'
error 3001.

Note that the parameters are both dates.
Also note that this works perfectly well in ACC97 format.
Also that it compiled without any indication of errors, or lost references.
me.start and me.end are taken from controls on an imput form. They are
formatted as short dates.

Thanks
Gerry Abbott

Code extract
-------------------------------------------------------------------
Dim qdfAdj As DAO.QueryDef
Dim rsAdj As DAO.Recordset
Dim mySql As String
Dim db As DAO.Database

Set db = CurrentDb
Set qdfAdj = db.QueryDefs("qryAccountsAdjSummary")

qdfAdj.Parameters("parameter1") = Me.Start
qdfAdj.Parameters("parameter2") = Me.End
Set rsAdj = qdfAdj.OpenRecordset

"qryAccountsAdjSummary"
SELECT tblStockItems.ProdId, tblMovements.mQuantity
FROM tblStockItems INNER JOIN tblMovements ON tblStockItems.stockId =
tblMovements.stockId
WHERE (((tblMovements.LocId)=sysconst(3)) AND ((tblMovements.sDate) Between
[parameter1] And [parameter2]))
ORDER BY tblStockItems.ProdId;
---------------------------------------------------------------------


Nov 13 '05 #1
1 1801
Hi all again.
I solved this problem, but still don't know why there is a different
behaviour in Acc97/2000.
Anothe filter in the query drew its parameter value from a function
Sysconst(3). I replaced this with [P3], another parameter,
and using the parameters property of the QDF, I assigned this parameter with
value returned by the function.

so
..........tblMovements.LocId)=sysconst(3)) ......
becomes
..........tblMovements.LocId= [Parameter3]..........

and

qdfAdj.Parameters("parameter1") = Me.Start
qdfAdj.Parameters("parameter2") = Me.End
Set rsAdj = qdfAdj.OpenRecordset

becomes

qdfAdj.Parameters("parameter1") = Me.Start
qdfAdj.Parameters("parameter2") = Me.End
qdfAdj.Parameters("parameter3")=sysconst(3)
Set rsAdj = qdfAdj.OpenRecordset

I also tried using =val(sysconst(3)) to get a value number arguament, but it
dident help !

Still does not explain why it works in one and not the other version!!


"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Wz*****************@news.indigo.ie...
Hi all
I'm converting a db from Acc97 to 2000. Everything works, except assigning
of a qdf object containing parameters, to a recordset.

The db, recordset, and qrydef objects are all referenced as DAO objects, and the reference to dao 3.6 is present and working.
The code breaks at the last statement (below) with an 'invalid arguament'
error 3001.

Note that the parameters are both dates.
Also note that this works perfectly well in ACC97 format.
Also that it compiled without any indication of errors, or lost references. me.start and me.end are taken from controls on an imput form. They are
formatted as short dates.

Thanks
Gerry Abbott

Code extract
-------------------------------------------------------------------
Dim qdfAdj As DAO.QueryDef
Dim rsAdj As DAO.Recordset
Dim mySql As String
Dim db As DAO.Database

Set db = CurrentDb
Set qdfAdj = db.QueryDefs("qryAccountsAdjSummary")

qdfAdj.Parameters("parameter1") = Me.Start
qdfAdj.Parameters("parameter2") = Me.End
Set rsAdj = qdfAdj.OpenRecordset

"qryAccountsAdjSummary"
SELECT tblStockItems.ProdId, tblMovements.mQuantity
FROM tblStockItems INNER JOIN tblMovements ON tblStockItems.stockId =
tblMovements.stockId
WHERE (((tblMovements.LocId)=sysconst(3)) AND ((tblMovements.sDate) Between [parameter1] And [parameter2]))
ORDER BY tblStockItems.ProdId;
---------------------------------------------------------------------



Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Huibert | last post by:
Can I and if so, how do I read Acc2003 files in e.g. Acc2000? Can I open it via ODBC? Or can I use Jet 4.0? I only need to read/write into existing tables. No developement or structure...
6
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
2
by: Vladislav Moltchanov | last post by:
Recently I have changed from Acc97 to Acc2000 (I had to supply some data entry tools for field data collection for users still using Acc97). Among lot of other complications coming with Acc2000...
1
by: Kjell S. Johansen | last post by:
I tried to convert an Acces-97 database to 2000, but got an error message (An eror occured while loading Form_frmDeltaker, do you want to continue?), then after answering yes, a message that the...
1
by: Mike Tickner | last post by:
Can anyone help ? I have a ACC2000 database which has password set. Whenever I now open db I get error 3197 'The Microsoft Jet database engine has stopped the process because you and another...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
3
by: Bill Cart | last post by:
The oldDb Command does not support Named Parameters. If I am reading them correctly, the docs say that the order of the parameter should match the order they are declared in the Stored Procedure....
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
2
by: Hexman | last post by:
Hello All, Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in my update statement and when trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.