Solved

Select statement

Posted on 2012-03-28
5
360 Views
Last Modified: 2012-03-28
I am not sure how to do this in Access.  The below doesnt return any values.  

Select * from table1 where field1 = 2
0
Comment
Question by:Sasha42
  • 3
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37779203
if field1 is Text Data type, use this

Select * from table1 where field1 = "2"


are you sure that there is value 2 in field1 ?
0
 
LVL 1

Expert Comment

by:andresdelfino
ID: 37779208
Is it possible for you to share with us the actual line of code?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37779213
post sample values from table1, or upload a copy of the db with the table
0
 

Author Comment

by:Sasha42
ID: 37779246
Below is the query sql.  I was hoping to be able to use the * instead of all those field names:

"SELECT tblCapRequestlMain.ID, tblCapRequestlMain.CapEXID, tblCapRequestlMain.DateOfRequest, tblCapRequestlMain.ProjectName, tblCapRequestlMain.Proj_Nbr, tblCapRequestlMain.Status, tblCapRequestlMain.BusinessUnit, tblCapRequestlMain.Company, tblCapRequestlMain.Dept, tblCapRequestlMain.RequestersFirstName, tblCapRequestlMain.RequestersLastName, tblCapRequestlMain.RequestersTitle, tblCapRequestlMain.RequestersPhone, tblCapRequestlMain.RequestersEmailAddress, tblCapRequestlMain.GateKeeperName, tblCapRequestlMain.GateKeeperPhone, tblCapRequestlMain.GateKeeperEmailAddress, tblCapRequestlMain.Budgeted, tblCapRequestlMain.RequiredByState, tblCapRequestlMain.ApprovedBudgetAmt, tblCapRequestlMain.RequestAmt, tblCapRequestlMain.EstimatedFreightDelivery, tblCapRequestlMain.EstimatedTax, tblCapRequestlMain.StatusChangeDate
FROM tblCapRequestlMain
WHERE tblCapRequestlMain.ID=2"
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 37779259
there is no problem using * in a query


if ID is text Data Type

select *
from tblCapRequestlMain
where ID="2"

or if ID is Number Data type, this should work

select *
from tblCapRequestlMain
where ID=2


just make sure there is a value equal to 2 in the field ID
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question