473,394 Members | 1,714 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,394 software developers and data experts.

pass paramter for recordset

23
hi :)

I have a query with criteria: "year([startdate])=year([forms]![order]![startd])

I want pass it as parameter

without the function of year I would write it like:

Expand|Select|Wrap|Line Numbers
  1.  str = Forms![order]![srartd]
  2.  
  3.   qdfMyQuery![Forms!order!startd] = str
  4.  
but how to write it with function?

thanks!!! :)
Aug 15 '16 #1

✓ answered by ADezii

You can use the Eval() Function in conjunction with the Parameters Collection of the QueryDef Object:
Expand|Select|Wrap|Line Numbers
  1. Dim qry As DAO.QueryDef
  2. Dim prm As DAO.Parameter
  3.  
  4. Set qdf = CurrentDb.QueryDefs("qryTest")
  5.  
  6. For Each prm In qdf.Parameters
  7.   prm.Value = Eval(prm.Name)
  8. Next
  9.  
  10. DoCmd.OpenQuery "qryTest", acViewNormal, acReadOnly

2 850
ADezii
8,834 Expert 8TB
You can use the Eval() Function in conjunction with the Parameters Collection of the QueryDef Object:
Expand|Select|Wrap|Line Numbers
  1. Dim qry As DAO.QueryDef
  2. Dim prm As DAO.Parameter
  3.  
  4. Set qdf = CurrentDb.QueryDefs("qryTest")
  5.  
  6. For Each prm In qdf.Parameters
  7.   prm.Value = Eval(prm.Name)
  8. Next
  9.  
  10. DoCmd.OpenQuery "qryTest", acViewNormal, acReadOnly
Aug 16 '16 #2
ben1988
23
THANKS
but please can you write it expressly with use of year function? please!!!
Aug 17 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: tomtailor | last post by:
Hello! I am migrating from PostgreSQL to DB2 and now I've got a problem with a Stored Procedure. In PG it is possible to pass SQL Results to a Procedure but how to do this in DB2? The online...
1
by: Rufus DeDufus | last post by:
This is more a matter of programming taste ... I have a Database DLL that is calling into Access through OLEDB, and exposes functions like AddPerson(STRING szFirstName, STRING szLastName, INT uAge)...
3
by: Lyn | last post by:
Hi, I have been experiencing a problem passing a LIKE statement in the WHERE argument of a DoCmd.Openform statement. I have posted that issue separately. However, in an attempt to work around...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
0
by: Andrew Mueller | last post by:
Hello, I am writing an ActiveX dll with VB 6.0 (mainly because that is what I am comfortable with). This dll is really a wrapper around another COM object which has a lot of methods using...
1
by: Doug Taylor | last post by:
I'm designing a C# object that must be usable from VC6 and VB6, as well as ..NET. How do I create the following method in C# so that VC6 and VB6 can pass in readonly recordsets? ...
0
by: stanley | last post by:
hello all, 1 - is it posiblle to pass ADO Recordset as a parameter from C++ managed code (.Net MC++) to a C++ unmanaged code (the old existing code) function?? how can i do it using the P-Invoce...
2
by: Ranginald | last post by:
Hi, I have a repeater based on a stored procedure. It pulls the following: catDesc Image The user sees the category description (catDesc) , and then clicks on the image (Image) which is...
9
by: One | last post by:
I have a main.php file that calls a php navigation menu. I want to pass the menu file a parameter to tell it which menu to display. Inside the main.php I have : include...
4
by: dhavalkvaria | last post by:
I am working in asp and i want to pass recordset cconsist name how can i pass it to javascript function i have written following <a...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.