473,545 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I restrict my results?

Hello. I have my data setup as follows:

Main
MEMNAME NAME TYPE LABEL

Variable
MEMNAME VARNAME NUMBER

Format
MEMNAME FMTVALUE NUMBER

The MEMNAME variable is the source dataset. The 3 tables are linked by
MEMNAME and MAIN.NAME -->Variable.VARNA ME --> Variable.NUMBER-->
Format.NUMBER.

Now I have a query that will search the Main table and return the value
based on a "Like" query. I have a subquery that will display the
format for that variable. The problem is that I can't get it so that
the subquery only displays the FMTVALUE if it matched by name **AND BY
MEMNAME**

Here is a screenshot of results:
http://www.mindspring.com/~a.pavluck/access.JPG

Nov 13 '05 #1
7 3225
Well for starters, lets rename ALL your tables and fields. "Variable",
"Format", "Number", etc. are all reserved words in Access/VBA that means
something and should NOT be used as object names. You're courting disaster
(or at very least deep confusion) by using them for your own names. Try
something like:

tblSurvey (old "Main")
SurveyID -autonumber (primary key)
Memname - text (whatever this is)
SurveyName - text (old "Name")
MyType -text (old "Char")
etc.

tblAnswers
AnswerID - number (0-99) or text (A-ZZ) your choice -primary key
AnswerDescripti on - text

tblResults
ResultID -autonumber -primary key
SurveyID -foreign key (related to tblSurvey)
AnswerID -foreign key (related to tblAnswers)
ResultDate
etc.

A normalized database eliminates repeating groups and redundant data and
then makes each record dependant on the key.

Now to answer your question: Look at the Access help for the "Like"
operator syntax. You'll need something like:

Like("myText*")

-Ed

"Alex L Pavluck" <ap******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Hello. I have my data setup as follows:

Main
MEMNAME NAME TYPE LABEL

Variable
MEMNAME VARNAME NUMBER

Format
MEMNAME FMTVALUE NUMBER

The MEMNAME variable is the source dataset. The 3 tables are linked by
MEMNAME and MAIN.NAME -->Variable.VARNA ME --> Variable.NUMBER-->
Format.NUMBER.

Now I have a query that will search the Main table and return the value
based on a "Like" query. I have a subquery that will display the
format for that variable. The problem is that I can't get it so that
the subquery only displays the FMTVALUE if it matched by name **AND BY
MEMNAME**

Here is a screenshot of results:
http://www.mindspring.com/~a.pavluck/access.JPG

Nov 13 '05 #2
First of all, get rid of the Varname rubbish. Assign at least
meaningful names to primary keys and foreign keys. Why do you need a
subquery at all? Why not join the two tables?
I think this is only hard because you're making it that way...

Nov 13 '05 #3
I used these names just to illustrate the problem. If you don't have a
solution to provide then please don't respond.

Again the problem is that I need to build a sub-query that will join on
*2* variables not just 1 from the master and child.

Nov 13 '05 #4
The point is, you won't get any responses if you insist on your own
confusing terminology as no one will understand what you want. The fact
that you want to filter on two fields (not "variables" , by the way -those
are values held in memory) whose values are identical suggests that your
data is not structured and related correctly - as I tried to point out.

But ignoring all that, to set the query criteria you request, use the AND
operator.
An example, using data from two separate table to filter data in a third :

SELECT tblAgencies.Age ncy, tblAgencies.Age ncyID
FROM tblAgencies, tblAgencyDonati on, tblAgencyPledge
WHERE (((tblAgencies. AgencyID)=[tblAgencyDonati on].[AgencyID] AND
(tblAgencies.Ag encyID)=[tblAgencyPledge].[AgencyID]));
The SQL to get the same result from three related tables:

SELECT tblAgencies.Age ncy, tblAgencies.Age ncyID
FROM (tblAgencies INNER JOIN tblAgencyDonati on ON tblAgencies.Age ncyID =
tblAgencyDonati on.AgencyID) INNER JOIN tblAgencyPledge ON
tblAgencies.Age ncyID = tblAgencyPledge .AgencyID;

-Ed

"Alex L Pavluck" <ap******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
I used these names just to illustrate the problem. If you don't have a
solution to provide then please don't respond.

Again the problem is that I need to build a sub-query that will join on
*2* variables not just 1 from the master and child.

Nov 13 '05 #5
Ok, your point is well taken.

I can not figure out how to view my subquery in SQL. I have a query
and I used the insert menu to insert a subquery (which is just another
query). At that time it asked to to link the query results with 1
variable. That is the problem, I need to link on 2 variables.

Nov 13 '05 #6
Here is the solution for anyone who is interested:

Modify Subdatasheet:
Note If you want to specify two or more fields in the Link Child
Fields or Link Master Fields box, enter the field names separated by a
semicolon (;)- for example, Last Name;First Name.

Nov 13 '05 #7
I think we're still confused.

The http://www.mindspring.com/~a.pavluck/access.JPG
image you sent shows a TABLE in datasheet view with a SUBDATASHEET open.
This is an Access "feature" that lets you link data tables for viewing in
this spreadsheet style view. Nearly all developers and good applications
ignore this feature (for good reasons) and depend on well designed forms
(based on queries) to show related information.

Contrast that to a QUERY which is a dataset of one or more related tables
and/or other queries. It allows you to filter and sort (Select query) and
add records (Append query), Update, etc. Open/create a new query in design
mode. Add the tables or (queries) you want; create links (joins) between
them by drag & drop of the related fields.
Enter the filter criteria and/or sort order you need. View the generated
SQL statement or datasheet results by using the View menu. If all this is
strange to you, use the query wizard and read through the Access Help to get
you started in query design.

If you still need/want your linked subdatasheet,(a nd I can't recommend it)
then link to your new query that has already done the selection on multiple
criteria/ that you needed.

Good luck
-Ed
"Alex L Pavluck" <ap******@gmail .com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Ok, your point is well taken.

I can not figure out how to view my subquery in SQL. I have a query
and I used the insert menu to insert a subquery (which is just another
query). At that time it asked to to link the query results with 1
variable. That is the problem, I need to link on 2 variables.

Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
6389
by: gc | last post by:
Hi, What is the purpose of the restrict keyword? gc
4
2179
by: Vijay Kumar R Zanvar | last post by:
Greetings, Are the following inferences of mine correct? 1. #include <string.h> char *strcpy(char * restrict s1, const char * restrict s2); a. s1 != s2 b. That means,
7
2662
by: tweak | last post by:
Can someone give me a short example as how to best use this keyword in your code? This is my understanding: by definition restrict sounds like it is suppose to restrict access to memory location(s) pointed to, so that only one declared pointer can store that address and access the data in those memory blocks, where I the data in those...
12
2478
by: Me | last post by:
I'm trying to wrap my head around the wording but from what I think the standard says: 1. it's impossible to swap a restrict pointer with another pointer, i.e. int a = 1, b = 2; int * restrict ap = &a; int * restrict bp = &b;
21
6478
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no definition found in K&R 2nd.
1
1184
by: dananrg | last post by:
If I want to restrict search results by country, what precisely do I need to include in searchTerm variable below? I've tried: searchTerm = 'restrict:countryUS blah blah' searchTerm = '<restrict> countryUS blah blah' Neither work. What am I doing wrong?
5
8206
by: Dakrat | last post by:
Allow me to preface this post by saying that this is my first database project, and while I have learned a lot, any concepts I have learned are hit and miss as I have found new requirements and researched solutions. That said, I have a "training" database with PowerPoint briefings which I have users access and complete training. The form then...
2
3248
by: venkat | last post by:
Hi, i came across restrict qualifier while looking the code. I haven't able to understand what does this do?. Can some one help me how does this makes the things restrict to an specified objects. It will be good, if explained with example. Appriciate your help in this regard. Thanks,
0
2970
by: copx | last post by:
Restrict keyword questions How far does the guarantee that an object is not accessed through another pointer go? I mean, all examples I have seen are simple stuff like: int f (int *restrict x, int *restrict y) { *x = 0; *y = 1; return *x;
23
4802
by: raashid bhatt | last post by:
what is restrict keyword used for? eg int *restrict p;
0
7420
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...
0
7680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
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...
1
7446
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...
1
5349
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...
0
3476
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...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1908
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
731
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...

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.