general problems with queries

A

atacams2

I made a table according to the wizard "mailing list"
I made a simple input form
I made a querry(with the wizard, again,) made by first name, last name,
phone numbers.
saved it.
and it doesn't work. the only thing I get is sth like the main table where
you can only alter/input your contacts, but only the records you have
selected for the querry.
What should I do? I downloaded an example from queries help and it works
fine but I didn't see any properties different from mine.
 
A

atacams2

I think I found it... I shouldn't have used the primary key?! it somehow
affected the query (it seems so, at least!)

Ο χÏήστης "atacams2" έγγÏαψε:
 
J

John Vinson

I made a table according to the wizard "mailing list"
I made a simple input form
I made a querry(with the wizard, again,) made by first name, last name,
phone numbers.
saved it.
and it doesn't work. the only thing I get is sth like the main table where
you can only alter/input your contacts, but only the records you have
selected for the querry.
What should I do? I downloaded an example from queries help and it works
fine but I didn't see any properties different from mine.

Please open your query in design view, select View...SQL from the
menu, and post the SQL text here. Also describe what values you're
getting, vs. what values you expect to get. "sth like the main table"
means nothing to me - sth is not a word and I can't dope out what it
should have been!

John W. Vinson[MVP]
 
A

atacams2

SELECT [Mailing List].MailingListID, [Mailing List].Prefix, [Mailing
List].FirstName, [Mailing List].MiddleName, [Mailing List].LastName, [Mailing
List].Suffix, [Mailing List].Nickname, [Mailing List].Title, [Mailing
List].OrganizationName, [Mailing List].Address, [Mailing List].City, [Mailing
List].State, [Mailing List].Region, [Mailing List].PostalCode, [Mailing
List].[Country/Region], [Mailing List].HomePhone, [Mailing List].WorkPhone,
[Mailing List].MobilePhone, [Mailing List].FaxNumber, [Mailing
List].AlternativePhone, [Mailing List].EmailAddress, [Mailing
List].CompuServeID, [Mailing List].Birthdate, [Mailing List].Nationality,
[Mailing List].EmrgcyContactName, [Mailing List].EmrgcyContactPhone, [Mailing
List].DateUpdated, [Mailing List].MembershipStatus, [Mailing
List].DateJoined, [Mailing List].PledgeAmount, [Mailing List].PledgePaidDate,
[Mailing List].DuesAmount, [Mailing List].DuesPaidDate, [Mailing
List].Hobbies, [Mailing List].HealthIssues, [Mailing List].Photograph,
[Mailing List].Notes
FROM [Mailing List]
WHERE ((([Mailing List].MailingListID)=[MailingListID]) AND (([Mailing
List].Prefix)=[prefix ]));



I was waiting for a form to input the data to be searched for but instead I
got the table "mailing list". I hope that clarifies it. Thank you
 
J

John Vinson

SELECT [Mailing List].MailingListID, [Mailing List].Prefix, [Mailing
List].FirstName, [Mailing List].MiddleName, [Mailing List].LastName, [Mailing
List].Suffix, [Mailing List].Nickname, [Mailing List].Title, [Mailing
List].OrganizationName, [Mailing List].Address, [Mailing List].City, [Mailing
List].State, [Mailing List].Region, [Mailing List].PostalCode, [Mailing
List].[Country/Region], [Mailing List].HomePhone, [Mailing List].WorkPhone,
[Mailing List].MobilePhone, [Mailing List].FaxNumber, [Mailing
List].AlternativePhone, [Mailing List].EmailAddress, [Mailing
List].CompuServeID, [Mailing List].Birthdate, [Mailing List].Nationality,
[Mailing List].EmrgcyContactName, [Mailing List].EmrgcyContactPhone, [Mailing
List].DateUpdated, [Mailing List].MembershipStatus, [Mailing
List].DateJoined, [Mailing List].PledgeAmount, [Mailing List].PledgePaidDate,
[Mailing List].DuesAmount, [Mailing List].DuesPaidDate, [Mailing
List].Hobbies, [Mailing List].HealthIssues, [Mailing List].Photograph,
[Mailing List].Notes
FROM [Mailing List]
WHERE ((([Mailing List].MailingListID)=[MailingListID]) AND (([Mailing
List].Prefix)=[prefix ]));



I was waiting for a form to input the data to be searched for but instead I
got the table "mailing list". I hope that clarifies it. Thank you

A Query is one type of object. A Form is a very different type of
object.

Creating a Query will not give you a form, so you can quit waiting...
<g>

Your query as written will search for records where the MailingListID
is equal to itself, and where the Prefix is also equal to itself...
and every record in the table will meet those criteria, unless the
field is NULL (which the ID can never be).

If you want the query to reference a Form for its criteria, you need
to use the syntax

WHERE
((([Mailing List].MailingListID)=[Forms]![Formname]![MailingListID])
AND (([Mailing List].Prefix)=[Forms]![Formname]![prefix]));

using your own form name of course. I'd actually suggest using
controls on the form with names DIFFERENT from the fields to which
they are bound (e.g. txtPrefix as a Textbox bound to the field
Prefix).

John W. Vinson[MVP]
 
Top