Code in a Form

A

Alexandra504

I have a form with several fields in which the user will input data in some
of them and then a querry will open with the criteria entered.

Right now I have 3 fields (and eventually I want to have 20). When I test
it, and enter data in one of the fields, the querry runs perfectly, but if I
enter data in 2 of the fields, the querry doen't run.

Any suggestions?
 
A

Alexandra504

Is there a way in which I can create a report with some fields and then the
user enters some data in some fields and then the querry opens based on the
data entered? Can you think of something?
 
K

Klatuu

Disregard that post. It has been going on for 2 days. It is just SPAM.

I don't think the query isn't running. I think it is returning nothing. Can
you provide more detail, please.
 
A

Alexandra504

You are correct. The querry is running but it is returning nothing. In the
querry criteria, I have typed the following under each corresponding field:

Querry field called 'Tier' I have typed: [Forms]![Enter Info Form]![TierTier]

Querry field called 'Member_ID' I have typed: [Forms]![Enter Info
Form]![Member_IDMember_ID]

Where: Forms is the object
Enter Info Form: is the name I have given to the text box in the form
Member_IDMember_ID: The name I have given to the field where

If I just enter in the criteria in the query one is works (the querry gets
open) but if I enter both codes in the criteria it doenn't pull the info, it
returns nothing

Thanks
 
K

Klatuu

That is because it is setting up an AND condition. It would have to find a
record where both Tier and Member ID are the same.

Is this correct?
[Forms]![Enter Info Form]![Member_IDMember_ID]
You have Member_ID twice as the name of your control?



Alexandra504 said:
You are correct. The querry is running but it is returning nothing. In the
querry criteria, I have typed the following under each corresponding field:

Querry field called 'Tier' I have typed: [Forms]![Enter Info Form]![TierTier]

Querry field called 'Member_ID' I have typed: [Forms]![Enter Info
Form]![Member_IDMember_ID]

Where: Forms is the object
Enter Info Form: is the name I have given to the text box in the form
Member_IDMember_ID: The name I have given to the field where

If I just enter in the criteria in the query one is works (the querry gets
open) but if I enter both codes in the criteria it doenn't pull the info, it
returns nothing

Thanks

Klatuu said:
Disregard that post. It has been going on for 2 days. It is just SPAM.

I don't think the query isn't running. I think it is returning nothing. Can
you provide more detail, please.
 
C

Corey-g via AccessMonster.com

I think that you want to put the criteria into the next row down for each
additional item (creating an 'or') instead of on the same criteria line
(creating 'and's).

So it would read like this:
Tier = [Forms]![Enter Info Form]![TierTier]
OR
Member_ID = [Forms]![Enter Info Form]![Member_IDMember_ID]
OR
Etc...

Does that make sense?
 
A

Alexandra504

This works but this is not what I want. Let me explain you. In the form I
have 2 fiels: Member_ID and Tier. If I enter just a Member-ID in the form
(for example 123) and hit ok the querry works fine. If I enter just a Tier
value (for example 9)works fine too. When I enter both fields (123 and 9) in
the form, with the 'or' code, it is pulling me all the member_id (123) plus
all the tiers (9). Some of the 123 records don't have a tier 9, and some of
the tiers 9 don't have 123 as member ID. This is what I get with the "OR"
code.

I need a code to be able to pull just these member id's 123 with the tier 9.
If one member has an id of 123 but the tier is another number, I don't want
the record when the querry is ran.

Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top