Solved

Select statement

Posted on 2012-03-28
5
365 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

789 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