473,608 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query

16 New Member
Anyone could tell me how i could have a form, that runs a query and returns the result in a report form? it seems simple but i can't get it to work.

so basically the criteria for the form should be a Drop down Menu, that gets its information (Drop down) from another table, and from that information, runs the query.

Also

if you could tell me how i could with words, rather drop down menu. So basically using text book. i would appreciate it.
Feb 19 '09 #1
7 1095
PianoMan64
374 Recognized Expert Contributor
@kpouya

Hey kpouya,

Welcome to Bytes.

I'm assuming this is your first post. One of the big things you're going to have to understand here is that we know nothing about what it is that you're trying to do with the exception of what it is you write. Since you aren't describing anything in detail at all, I'm assuming you haven't even started the project yet.

What we're going to need to know is:

1. Current Table structure that would allow us to build an example of what you're explaining? Exmaple:
Expand|Select|Wrap|Line Numbers
  1. TableName
  2. -----------------------------------------------------
  3. FieldName    Field Type    Description of Field
  4. -----------------------------------------------------
  5. ID              Number(12)    Primary Key Value
  6. FirstName       String(15)      First Name of Customer
  7. LastName        String(30)      LastName of Customer
  8.  
  9.  
  10. and so on...
  11.  
2. You're going to have to explain how you've built the form. What controls are on the form and what it is that you want it to do, or not do on the form.

3. Explain the steps you've taken, and where you're having problems.

This way, you'll find a great deal more people willing to help you out, if you can do a lot of the leg work.

This is not intended to be a free Developer network, its simple users helping other users with issues so they can learn how to do things.

With all that said, try putting all this information together, and I'd be more than happy to help you out.

Thanks,

Joe P.
Feb 19 '09 #2
NeoPa
32,566 Recognized Expert Moderator MVP
@kpouya
Perhaps it would help you to understand if I explain that you don't run a query then convert it into report form. What you do is design the report and include the query as the Record Source. That way, any time you run the report, it necessarily runs and uses the query.
Feb 19 '09 #3
kpouya
16 New Member
Hey Joe P.
So what i am trying to develop is a knowledge database. i will try my best to explain the structure i got..

tbl_articles
article name
article year
article author
article publisher
article field (business, science, social science, arts, etc)
article subfield (so let say i got choose business, then i would have like accounting, marketing, management, etc)
article type (so like research, journal, review)
article sumary
article keywords

frm_articleentr y
article name (text box)
article year (drop down)
article author (text box)
article publisher (text box)
article field (drop down)
article subfield (gets it values from a table, and its values are based on selection from article field) [drop down]
article type (drop down)
article summary (text box)
article keywords (text box)

so i want to do query, where i should be able to do a search based on the keyword(s), based on the person's keyword

and also

i want to be able to choose a field then a subfield then do a query based on that

possible?
Feb 20 '09 #4
kpouya
16 New Member
anyone is able to help?
Feb 23 '09 #5
PianoMan64
374 Recognized Expert Contributor
@kpouya
Hey kpouya,

Sorry for not getting back to you sooner. It seems that the instructions that I gave you were a little unclear as to what it is that I was looking for.

The information that I'm trying to find out is what have you done (Built) so far and where are you having the issue?

Since you didn't include field types in your answer that would be somewhat helpful to trying to solve your problem.

Like NeoPa had said, can you include a description of what it is that you have so far, where you're having problems, and what specificy the question(s) that you have about this process.

You have to understand that building a query is simply a set of instructions that combine and set of one or many tables into some form that is displayed in order to answer a question. It seems you're trying to write the query before you've even written the table structure.

From what I read on your last answer, it seems you have ONE table that has all the items. You want to be able to filter those items in some order, and display them on screen, or in a report?

You want to be able to enter those filtered items on the form?

1. If that is the case, then you're going to need to build a query that displays every record in the order that you want it in.

2. Then for the fields on the form, your going to have to do something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2. docmd.OpenReport "ReportName",acViewNormal,,"[Artical Field]='" & me.ArticalField & "' AND [Artical Subfield] = '" & me.ArticalSubField & "'"
  3.  
  4.  
Feb 23 '09 #6
kpouya
16 New Member
Hello PianoMan64

Thank you for your replay. I will try to give you a better description this time.

i have built the following items:

tbl_articles
this is where all the articles information gets recorded.

article_name
article_year
article_author
article_publish er
article_field (business, science, social science, arts, etc)
article_subfiel d (so let say i got choose business, then i would have like accounting, marketing, management, etc)
article_type (so like research, journal, review)
article_sumary
article_keyword s

frm_articleentr y
this form help the person to enter article information to get stored into tbl_articles

article_name (text box)
article_year (drop down)
article_author (text box)
article_publish er (text box)
article_field (drop down)
article_subfiel d (gets it values from a table, and its values are based on selection from article field) [drop down]
article_type (drop down)
article_summary (text box)
article_keyword s (text box)

so what i want to do is do both of the following

1. create a form based on above information so the person can run a query that allows the person select a field then a subfield and run a query based on the information.
so it would be something like

article_field (drop down)
article_subfiel d (drop down)
and run a query button.

i know how to set up the form, but what i want to know is how do i get the button to run the query based on information selected from the drop downs.

2. i want to create a form where the person text box input. so the person can let says put a word in the text box and run a query based on it. so lets think of it as search engine. so therefore how can i create a search engine with access? is that even possible?
Feb 23 '09 #7
PianoMan64
374 Recognized Expert Contributor
@kpouya

Hey kpouya

The simplest way you're going to do what you're speaking of, is to create a string that contains only the criteria. Then take that criteria and use it to open the report that you're speaking of.

EXAMPLE:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSearch_Click()
  2.      Dim strCriteria as String
  3.      If Not IsNull(me.Artical_Field) Then
  4.           If Len(strCriteria) > 0 Then
  5.                strCriteria = strCriteria & " AND [Artical_Field]='" & me.artical_field & "'"
  6.           Else
  7.                strCriteria = strCriteria & "[Artical_Field]='" & me.artical_field & "'"
  8.           end if
  9.      end if
  10.      If Len(strCriteria) > 0 Then
  11.           DoCmd.OpenReport "ReportName", vbViewNormal,, strCriteria
  12.      End if
  13. End Sub
  14.  
That should give you enough to get you started.

Let me know if you need any more help,

Joe P.
Feb 26 '09 #8

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

Similar topics

2
3425
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the new values are updated in all corresponding tables (the function of the pages in question). However, on the page that does the DB update, I also want to do some checks on the data before performing the update. Now, the problem that I am...
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
9
3120
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
3
5380
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
4
2142
by: Diamondback | last post by:
I have two tables, WIDGETS and VERSIONS. The WIDGETS table has descriptive information about the widgets while the VERSIONS table contains IDs relating to different iterations of those widgets over the years. The idea is that from any widget in the database you can look forward and backward to see different versions of the widget through the years. Here are the tables: WIDGETS widget_id name
14
3878
by: Dave Thomas | last post by:
If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or her name, email, and age - but AGE is optional. My insert would look something like:
0
3497
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or none of its list boxes to form the dynamic query I am looking to get some feedback in reference to...
6
4836
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID SalesManName AT Alan Time
4
3123
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I might be able to accomplish the results in two steps by using two queries. If this is possible how can I do it? Thank you, Stan Hanna
6
4392
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one field between them. The join field in both tables are indexed and I'm selecting 1 field from each table to lookup. The Access query is taking more than 60 second to retrieve 1 record and if I execute the same query within the Query Analyzer, it...
0
8000
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,...
1
8145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6815
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
6011
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
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3960
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
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1328
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.