473,412 Members | 2,081 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,412 software developers and data experts.

open query or report with docmd

23
i define query with parameters
i set them by DoCmd.SetParameter

and after, open the query with DoCmd.OpenQuery

it's not ask to me to supply parameters, so i guess it really past...but,im not convinced it happen properly because the query dont do the expected.
and it happen with different queries

is there different way open query with parameters?

(i do have access 2010)

thanks!!
Sep 5 '16 #1
4 1589
Narender Sagar
189 100+
Hi Ben
Pl. check following link, it may help you in this regard.
https://msdn.microsoft.com/en-us/lib...or=-2147217396
regards,
Sep 5 '16 #2
zmbd
5,501 Expert Mod 4TB
Ben, what are you expecting the setparameters command to do?

Once you run this command the parameter is set and any query executed within the scope of the code is going to be fed the value set.

It might be better if you could do two things:
1) Show us the Query SQL - PLEASE format the posted SQL using the [CODE/] format control.
2) Show us the code you are using to call the query. Once again, PLEASE format the posted SQL using the [CODE/] format control.

Narender Sagar, good link, I think however, maybe too much information for where Ben is currently at...?


Ben, you really need to review the tutorial I PM'd you. It will cover setting up queries and using WHERE conditions, Parameters, etc... in "bite sized chunks" in a systematic method.
Sep 5 '16 #3
ben1988
23
zmbd, like i told i tried it with different queries
and when i open the query directly - it works
so i dont really think it's matter to put here the sql

i just ask u
do u have query with where field1=[par]
when [par] is parameter
how u pass parameter and call it query via vba?? there are other ways to do it apart from my way?
there are any highlights i have to put attention?

thanks
Sep 5 '16 #4
zmbd
5,501 Expert Mod 4TB
Ben, that's a non-answer to the questions asked.

1) What did you expect the DoCmd.SetParameter to do?
This command answers the prompts that a direct call to the query would make. Please read thru:
DoCmd.SetParameter Method (Access)

2) Show us the Query SQL - PLEASE format the posted SQL using the [CODE/] format control.
If we have this, then we have a much better chance of pointing you in the correct direction towards a solution

3) Show us the code you are using to call the query. Once again, PLEASE format the posted SQL using the [CODE/] format control.
If we have this, then we have a much better chance of pointing you in the correct direction towards a solution

++ You simply must answer the questions that we the Experts ask of you if you want us to help you help yourself. In this case we do not know how you are getting the information for the parameters, are you pulling from a form, hard coding, what? We don't know if you have typo or something else malformed in the code. Finally, we don't know if you have simply misunderstood the code you are using.

BTW: The link Saga gave you will answer your question; however, it's a lot of information to digest.
https://msdn.microsoft.com/en-us/lib...or=-2147217396

Another version of this can be found at:
Access Tutorial 10: Parameter Queries


A large number of use form controls with parameters within stored queries, there is an example of how to do this in the link.

PLEASE, PLEASE, PLEASE, go thru the tutorial link I PM's you. It will provide you with the hands-on experience you need to answer these questions.
Sep 5 '16 #5

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

Similar topics

5
by: Ryan Hubbard | last post by:
Is it possible to get the recordset from an open query window? So you run the query. The window is open. Can vba retrieve this data?
1
by: Andy | last post by:
Hopefully an easy one? Have created a Form with numerous ComboBoxes. On hitting OK on the form this calls up a Query which has all the criteria "links" to my Form. All works OK. How do I call...
6
by: erick-flores | last post by:
Hello, I want to make a report for a single compressor. Instead of showing a report for all the compressors. I would like to place a button in the compressor form, so whenever I want to display a...
0
by: Kelii | last post by:
Evenlater, Yeah, I don't open the report in preview mode when I setup my recordsource, filters, or sorts. Before I give my solution, I would say that your code will be simpler if you drop the...
3
by: Naushad | last post by:
Hi All, I am trying to open the report conditionally from the dialogue box form. In the form there are three field. cboEmployees StartDate EndDate I have used these field in criteria to...
0
by: tasawer | last post by:
Hi, I have a report that has underlying query, that opens up from form Clientletters. SELECT ClientLetter.LetterID FROM ClientLetter INNER JOIN Clients ON ClientLetter.ContactID =...
6
by: SusanK4305 | last post by:
Here are my two code for the Report that will be opened. This Report is in Access and is name rpt1, It isn't opening like it should. Please Help... Thank you. Private Sub cmdApplyFilter_Click() ...
0
by: Jason Hamilton | last post by:
Hey all, Okay, so here's what's going on. I have a customer who wants me to push the reports generated by MS Access to his corporate website on demand. I have most of this problem solved (by...
2
by: Jeffrey Tan | last post by:
Hi there.. So i am trying to email a parameter query report that takes in a date formatted to m/yyyy and compiles a report based on the specific month and year. however, when i click the...
3
by: barter27293 | last post by:
I have got a report with a list of names and I want to make them hyperlinks, so that when clicked on they open another report in a window showing all the entries in the database filtered under their...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.