473,480 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Create 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 1084
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,556 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_articleentry
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_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_articleentry
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_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 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_subfield (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
3409
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...
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"...
9
3105
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...
3
5366
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...
4
2126
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...
14
3845
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. ...
0
3481
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...
6
4810
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 ...
4
3111
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...
6
4365
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...
0
7059
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,...
1
6758
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...
0
7010
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
5362
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,...
1
4799
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...
0
4499
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...
0
3011
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...
0
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.