473,657 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create Automatic Parameter Query?

58 New Member
Hi there?
I have a PARAMETER QUERY for selecting a certain records on user request, works fine currently; But on every new table I have to set the parametric properties manually inorder for my users to use it. I want it be automatic, just after table selection there should be a way of setting a parameter without going to the design view or whatsoever. The tables can be selected from combobox.
How can I achieve this?
any hint please!
Nov 14 '10 #1
14 3117
colintis
255 Contributor
If you're doing this in through form's combobox, then you'll need to change the query criteria pointed to the form's combo box ([Form]![<form name>]![<combo box name>])

If the above method is not understandable, please tell us more details on what have you done so far. Pasting code (with CODE TAG) would be better if you are not sure how its done properly
Nov 16 '10 #2
Moah Scout
58 New Member
Thanks! What you have explained works even in my db, but in my db I have two tables set as example, the user of this DB will have their own table exported from external sources; After his export he want imediately start using the resources without calling somebody from remote area for assistance on change the query criteria pointed to the form's combo box ([Form]![<form name>]![<combo box name>]), it doent sound good.
What if we build this SQL (query criteria) in a form for whatever selection of a table from combobox.
I have a Combobox shows a list of TablenamesAndQu eries in the db, (the queries doesnt have to have the Creteria). The selection criteria should be made in the forms through SQL or VBA.
How could this be achieved?
Please help
Nov 26 '10 #3
colintis
255 Contributor
I'm not understanding quite well on what you tried to say...Can you tell me more about what is this external source? is it another access database table or some other database files? If so you can simply make a link table to that file source, so whenever he gets the updates he doesn't need to change things again again and again. But exclude sources such as SAP, as they do need manual export first somehow.

On the other hand with more VBA parts, you can predefine a set of SQL code, then simply ask an input of the new table name (if structure is the same), and put this name into the FROM clause to run the query at the end as a whole.
Nov 26 '10 #4
Moah Scout
58 New Member
Yeah!
Its a kind of Access Tables from another DB.
Now how to create this linktable to that source? so whenever he gets the updates he doesn't need to change things again again and again
I might get lost if exposed alone to VBA-JUNGLE bymyself.
Please help in both cases!
Nov 26 '10 #5
colintis
255 Contributor
compare to other programming languages such as c++, VBA is simply a small forest.

To create a linked table, I had replied that in your other question thread, see if it works.

The VBA part I mentioned requires to work with the link table, as soon you have the new table linked (with different names), then you have everything prepared in the SQL first except the FROM clause table name. Once the user puts in the new name of the table, everything will go automatically to finish the job.
Nov 26 '10 #6
Moah Scout
58 New Member
That thread could work on exporting Exel2007.
The SQL and VBA are the ones looking for.
Let me be clear!
I have set Connection via ODBC Connection String as follows:
Expand|Select|Wrap|Line Numbers
  1. Sub openDB_DAO()
  2. Dim db As DAO.Database
  3. Dim dbName As String
  4. Dim c As Container
  5. Dim doc As Document
  6. dbName = InputBox("Enter a name of an existing database:", "Database Name")
  7. If dbName = "" Then Exit Sub
  8. If Dir(dbName) = "" Then
  9. MsgBox dbName & " was not found."
  10. Exit Sub
  11. End If
  12. Set db = OpenDatabase(dbName)
  13. With db
  14. ' list the names of the Container objects
  15. For Each c In .Containers
  16. Debug.Print c.Name & " container:" & _
  17. c.Documents.Count
  18. ' list the document names in the specified Container
  19. If c.Documents.Count > 0 Then
  20. For Each doc In c.Documents
  21. Debug.Print vbTab & doc.Name
  22. Next doc
  23. End If
  24. Next c
  25. .Close
  26. End With
  27. End Sub
Now how can I go around this to retrive tables from this Connections and set the parameters so that to link to a Criteria Query?
Nov 26 '10 #7
colintis
255 Contributor
As from the other post we talked earlier, the processes you need is to create link table with Excel. So first I'm point out the thing you need to do, I'll be back to post some example codes later.
  1. Ask user to give input of their excel file
  2. Check if this worksheet name exist in the link table, if yes remove it
  3. create a new link table with that user's excel file
  4. finish the job.
Nov 26 '10 #8
Moah Scout
58 New Member
Yes! We are heading the same direction!
Nov 26 '10 #9
Moah Scout
58 New Member
It can be database or just excel sheet, all have the same meaning for me!
If you give one I will finish the next
Nov 26 '10 #10

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

Similar topics

4
3928
by: Greg | last post by:
I am trying to set a perameter for my query but keep getting an error: The Microsoft Jet database engine does not reconize '' as a valid field name or expression. The only difference from other queries with the same parameter in my database is that this query is a crosstab. How do I fix this problem? Thanks, Greg
1
3800
by: Cory | last post by:
When I run the subroutine testEmailContacts the msgbox says that there is only 1 record. The sql for qyEmailContactsQyCard is below. There is over 3000 records in the table "tbl:Contact". What am i doing wrong? Thanks in advance. PARAMETERS cardYesNo Bit, ParSearchCard Bit; SELECT .ContactID FROM WHERE (((.Card)=)) OR ((()=No));
1
2575
by: carrionk | last post by:
Hi, I have created a Subform which SourceObject is a parameter query. This is the Query: Qry Name:80IsscomProduct SELECT * FROM Isscomp28 WHERE Like ;
1
1385
by: biljana | last post by:
Hi! Could somebody help me to create simply parameter query? I need query like this: select from table_name; column_name should be parameter from combo box or user can type column name.
2
1767
by: Haas C | last post by:
Hey all, I created a Query (in Design View) which asks the user for an "As Of Date" which would then display relevant data. I put in the Criteria Row of the Query Design for the Date field. Is there anyway to put in a default of today's date in the input box and allow the user to change it to whatever they want? Please let me know if this needs further clarification. Thanks for all your help in advance.
1
1481
by: deveshparekh | last post by:
I have created a query asking to calculate a third number using two fields in the query. However when I run the query I get a enter parameter query box asking me to enter information on one of the fields when the information is in the query. My question is how do I remove this request box when I didn't create it as a parameter, as I just want it to carry out the query action using data in the query cells.
4
2911
by: GladGad | last post by:
I am not a real well versed query writer and therefore am having some problems figuring out how to write a parameter query where I want to input a partial name. I have tried a few different things, but either get no results or all of the records in BANKS are returned. I am using Access 2000 on XP. I am using three tables for this query: BANKS BankID (pk) BankName Other fields that are not pertinent to this query VENDORS ...
1
458
by: Kissi Asiedu | last post by:
How could I create a parameter query that will return values that partially or whole match to a user input. For instance; if a user inputs "stu", it should return values that have "stu" in it. Like "Student, Studio, stupid" etc.Plase help.
2
3517
by: brat33 | last post by:
I am trying to modify some code to create a mail merged label document within Word 2007, using a Access 2007 Parameter Field. My issue comes about when I cannot see the Parameter Query within the selecting list in Word. I would rather not have 40 queries for each year we are pulling, so I want to use the parameter query to simplify things. I have thought using a Temp. Table and pulling from there - but have no clue as to how to go about...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.