Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2009
    Posts
    3

    Basic question, urgent help needed.

    I don't have time to learn Access right now, but have an urgent problem and need help. I have a table with a variable , "Date" with several thousand values. Due to an error on my part the most recent 2000 have to be set three weeks earlier (-21) and then saved under the same variable name. The three intervening weeks of dates have no values currently so there will be no naming conflict.



    I can open the database and edit them one by one but need a simple process for doing this to an entire range.

    Thanks!!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't have time to learn how to drive right now but can I borrow your car so I can take a 1000 mile trip by myself?

  3. #3
    Join Date
    Mar 2009
    Posts
    3

    LOL Ruralguy. Thanks for your assistance. I really needed help and was looking for advice. Your advice let me know this forum is not the place to get it.

    "You might be a red neck if.... your family tree doesn't branch"

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I couldn't resist. I don't mind helping but you do understand we do not speak the same language yet. ie: Tables do not have variables.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do you really mean the Field in the table is named "Date"? If so then you should be aware that Date is a reserved word in Access and should not be used for your name for anything. Setting a Date field back 3 weeks or 21 days is not difficult but is there some way to identify the records other than the last 2000 entries?

  6. #6
    Join Date
    Mar 2009
    Posts
    3
    I have a Coral Reef Tank controlled by a device called an Aquacontroller 3 and software called Aquanotes.

    AquaDB is a database for the device and the accompanying program. Aquanotes polls the IP of the Aquacontroller regularly for several tank conditions and events. Based on observed values, the Aquacontroller turns certain (X10) devices connected to the Reef Tank on and off.

    Date is employed in several tables, including two in particular "EventLog" and "TankConditions". All fields are created and populated by the program, none by me.

    In these two tables all records possessing a Date field value of greater than or equal to 3/25/09 00:00:00 are off by 18 days. That is, 3/25/09 11:00:00 AM should be 3/07/09 11:00:00 AM.

    I need to subtract 18 from each record's Date field where the value is greater than 3/24/09 and save it back into the record.

    Is this possible to do systematically?


  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Simple answer is yes but I'm not an SQL wizard so I will need to practice a bit. Start by making a backup of your db so you can restore if we blow it. The use the query builder to create a SELECT query to zero in on the criteria. Any chance you can email me the db or a sample of it so I can practice? I don't think your post count is high enough to just attach it here.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Something like:
    SELECT * FROM YourTable WHERE YourTable.DateField > #3/24/09#

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Something like:
    UPDATE YourTable SET YourTable.DateField = DateAdd("d",-18,YourTable.DateField)
    WHERE DateValue(YourTable.DateField) > #3/24/09#
    ... It will be necessary to just look at the DateValue since any time after midnight will be > than just the date.
    Here's a link that describes the DateTime field.

  10. #10
    Matrix's Avatar
    Matrix is offline Admin
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2005
    Posts
    518
    RuralGuy: fishnu replied to the forum notification email with the db file. So I just upload it directly other than tell him to send it again.

    P.S. There are no upload restrictions for new members.

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for the assist and info Matrix.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Put the following text (please copy and paste) in a new query in SQL view.
    Code:
    UPDATE TankConditions SET TankConditions.[Date] = DateAdd("d",-17,[Date])
    WHERE (((TankConditions.Date)>#3/24/2009#));
    save the query and then double click it from the database window. Be sure and run this on the BackUp RIGHT? if it does what you want then in the real db just rename the table and then inport the modified table from the backup. Better safe than sorry. Let us know how you make out.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    BTW, the picture you posted is Access 2007 but the file seemed to be in Access 95 format. Is that correct?

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

Similar Threads

  1. Using Access Instead of Visual Basic
    By dinz in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 10:33 AM
  2. basic query codes
    By joms222 in forum Queries
    Replies: 1
    Last Post: 03-20-2009, 11:31 AM
  3. Basic Question
    By chris11590 in forum Forms
    Replies: 0
    Last Post: 08-04-2008, 05:57 AM
  4. Rookie needs help with basic reporting
    By James Rousselle in forum Reports
    Replies: 0
    Last Post: 03-01-2007, 02:36 PM
  5. I need help! Urgent! :(
    By Suzan in forum Database Design
    Replies: 0
    Last Post: 04-08-2006, 11:58 PM

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