Results 1 to 2 of 2
  1. #1
    Diamond is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    13

    Having trouble with SELECT statement on a query


    I am having a very difficult time trying to figure out how to write out a select statement in a query. I was told previously to use DATEADD to add days to a check box. I would like to add, say, 365 days to a check box and have it show the next test date. I really don't have any idea how to write it out. I am putting the following into a query in the field name: SELECT [AcctNo], [SerialNo], DATEADD(day,365,LastTestDate) as NextTestDate from TestHistorytbl. I keep getting an error message saying: You have written a subquery that can return more than one field without using the EXISTS reserved word in the main query's FROM clause. Revise the SELECT statement of the subquery to request only one field. I don't know what all this means and I need help. Any help is appreciated.

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You said that you are trying to add days to a check box. Is that correct? Technically you can do that but you would most likely end up with a date of 1/1/1900 which is probably not of any value.

    I am going to assume that your field LastTestDate is a date field, and as such, the query would look like this

    SELECT [AcctNo], [SerialNo], DATEADD("d",365,LastTestDate) as NextTestDate
    FROM TestHistorytbl

    The "d" tells the function the interval( "d"= days). You can use "yyyy" for year, "m" for month, "q" for quarter (check out the help section to find out what other intervals are available.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Trouble with a Select Statement
    By mrfixit1170 in forum Programming
    Replies: 3
    Last Post: 09-17-2012, 11:18 AM
  2. Multi Select List Box Trouble
    By Subwind in forum Forms
    Replies: 2
    Last Post: 06-06-2012, 04:00 AM
  3. Need a select statement
    By gahawy in forum Queries
    Replies: 5
    Last Post: 01-15-2011, 04:02 PM
  4. Replies: 11
    Last Post: 12-14-2010, 01:25 PM
  5. select statement
    By jellybeannn in forum Access
    Replies: 5
    Last Post: 08-13-2010, 05:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums