If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Setting up a query
Hi there
I know this is a basic question, but I'm trying to design a query in a database so that I can enter one field (for example a music cd name) and have it display all information about the record that is searched on. So far, I've manager to build my query but it shows the entire table. Could anybody assist me? Many thanks Gareth Saunders ex BOFH |
#2
|
|||
|
|||
Setting up a query
SELECT * FROM SomeTable WHERE SomeField = [Enter text to match]
.... or ... SELECT * FROM SomeTable WHERE SomeField LIKE "*" & [Enter text to match] & "*" The text that you enter between the square brackets will be displayed as a prompt to the user when the query is run. Also take a look at the Sales by Year report in the Northwind sample database that comes with Access, for a more sophisticated example that uses a custom form to prompt the user for the parameters. -- Brendan Reynolds Access MVP "Gareth Saunders" wrote in message ... Hi there I know this is a basic question, but I'm trying to design a query in a database so that I can enter one field (for example a music cd name) and have it display all information about the record that is searched on. So far, I've manager to build my query but it shows the entire table. Could anybody assist me? Many thanks Gareth Saunders ex BOFH |
#3
|
|||
|
|||
Setting up a query
Hi Brendan ... I tried your two examples below and I get them to function in
the SQL window. However when I view the output and then change to the query grid the following is in the criteria field and produces the same output as the SQL. Like "*" & [Enter text to match] & "*" Why would I need to go the SQL route? Thanks "Brendan Reynolds" wrote in message ... SELECT * FROM SomeTable WHERE SomeField = [Enter text to match] ... or ... SELECT * FROM SomeTable WHERE SomeField LIKE "*" & [Enter text to match] & "*" The text that you enter between the square brackets will be displayed as a prompt to the user when the query is run. Also take a look at the Sales by Year report in the Northwind sample database that comes with Access, for a more sophisticated example that uses a custom form to prompt the user for the parameters. -- Brendan Reynolds Access MVP "Gareth Saunders" wrote in message ... Hi there I know this is a basic question, but I'm trying to design a query in a database so that I can enter one field (for example a music cd name) and have it display all information about the record that is searched on. So far, I've manager to build my query but it shows the entire table. Could anybody assist me? Many thanks Gareth Saunders ex BOFH |
#4
|
|||
|
|||
Setting up a query
You don't. But I can't put the query design grid in a newsgroup post! :-) It just takes a lot longer to describe how to do something using the design grid than it does to post the SQL. So I usually post the SQL first. I'm usually prepared to explain how to do it using the grid if asked, but I think you know how to do that now? -- Brendan Reynolds Access MVP "Tee See" wrote in message ... Hi Brendan ... I tried your two examples below and I get them to function in the SQL window. However when I view the output and then change to the query grid the following is in the criteria field and produces the same output as the SQL. Like "*" & [Enter text to match] & "*" Why would I need to go the SQL route? Thanks "Brendan Reynolds" wrote in message ... SELECT * FROM SomeTable WHERE SomeField = [Enter text to match] ... or ... SELECT * FROM SomeTable WHERE SomeField LIKE "*" & [Enter text to match] & "*" The text that you enter between the square brackets will be displayed as a prompt to the user when the query is run. Also take a look at the Sales by Year report in the Northwind sample database that comes with Access, for a more sophisticated example that uses a custom form to prompt the user for the parameters. -- Brendan Reynolds Access MVP "Gareth Saunders" wrote in message ... Hi there I know this is a basic question, but I'm trying to design a query in a database so that I can enter one field (for example a music cd name) and have it display all information about the record that is searched on. So far, I've manager to build my query but it shows the entire table. Could anybody assist me? Many thanks Gareth Saunders ex BOFH |
#5
|
|||
|
|||
Setting up a query
Thank you. I just thought there might be something I was missing.
Regards "Brendan Reynolds" wrote in message ... You don't. But I can't put the query design grid in a newsgroup post! :-) It just takes a lot longer to describe how to do something using the design grid than it does to post the SQL. So I usually post the SQL first. I'm usually prepared to explain how to do it using the grid if asked, but I think you know how to do that now? -- Brendan Reynolds Access MVP "Tee See" wrote in message ... Hi Brendan ... I tried your two examples below and I get them to function in the SQL window. However when I view the output and then change to the query grid the following is in the criteria field and produces the same output as the SQL. Like "*" & [Enter text to match] & "*" Why would I need to go the SQL route? Thanks "Brendan Reynolds" wrote in message ... SELECT * FROM SomeTable WHERE SomeField = [Enter text to match] ... or ... SELECT * FROM SomeTable WHERE SomeField LIKE "*" & [Enter text to match] & "*" The text that you enter between the square brackets will be displayed as a prompt to the user when the query is run. Also take a look at the Sales by Year report in the Northwind sample database that comes with Access, for a more sophisticated example that uses a custom form to prompt the user for the parameters. -- Brendan Reynolds Access MVP "Gareth Saunders" wrote in message ... Hi there I know this is a basic question, but I'm trying to design a query in a database so that I can enter one field (for example a music cd name) and have it display all information about the record that is searched on. So far, I've manager to build my query but it shows the entire table. Could anybody assist me? Many thanks Gareth Saunders ex BOFH |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cross tab query construction with Subqueries | Steven Cheng | Running & Setting Up Queries | 7 | February 13th, 2006 06:52 PM |
Access shuts down, when i try to save this query | Dann | Running & Setting Up Queries | 12 | February 3rd, 2006 02:49 AM |
Advanced SQL Query | Wes Henry | General Discussion | 3 | December 14th, 2005 09:55 PM |
AHHHH-Get Data from Multiple Excel workbooks | JAA149 | General Discussion | 5 | October 30th, 2005 05:19 PM |
Office 2003 installation problem, log file attached.... | Ryan | Setup, Installing & Configuration | 0 | January 20th, 2005 06:57 PM |