Results 1 to 6 of 6
  1. #1
    Rhemo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2012
    Posts
    10

    Increment value in lookup Field

    Is it possible to run an update query to increment the value in a lookup field on all records, if the values are not numerical?
    For example if the look up field contains Unit A, Unit B etc? can a query be executed so that anything with Unit A will be set to Unit B, and Unit B records will be set to Unit C?



    Many thanks.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You would probably need to create your own User Defined Function (UDF) in VBA to accomplish that. What are all of the actual values in this particular field and what is causing you to need to increment this value? You may have a design issue that needs to be reviewed.

  3. #3
    Rhemo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2012
    Posts
    10
    The DB is for student lockers. The field in question contains the Year they are in, 1st Year, 2nd Year, 3rd...and so on up to 6th Year. I put these into a lookup field so it would just be a matter of using a drop down menu to select them. Being slightly hungover I just realised that these values would need to be increased once a year. I already have a delete query to remove old useless records, but require these values to just increment one position. I think it may just be easier to forget the lookup field and allow the user to manually enter this as a regular numerical character then use a query to increment?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    It sounds like it should be two different fields. One for the locker value and one for the "year they are in". Did I miss something?

  5. #5
    Rhemo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2012
    Posts
    10
    The locker number never changes they are static. The Student however will move from Year 1 to Year 2 etc each year. This is the only value that needs to increment. I think I just made the mistake of making this a lookup field with defined values for ease of use. I'll remove this and leave this field to be manually entered in straight numerical values which should be easier for updating.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Excellent!

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

Similar Threads

  1. Replies: 15
    Last Post: 05-17-2012, 01:12 PM
  2. Increment Field Value
    By Malseun in forum Access
    Replies: 9
    Last Post: 02-03-2012, 04:55 AM
  3. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  4. How to Increment A Number Field
    By Advanced in forum Programming
    Replies: 3
    Last Post: 01-27-2010, 02:36 PM
  5. Replies: 2
    Last Post: 12-08-2009, 01:19 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