Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2008
    Posts
    5

    Need help with code

    Hi!
    I am making a database and I want to posts into priority groups.
    Something like this:


    Code:
    Me! [Priority group] 
    	if [Last edit in post] >= [date() - 6 weeks]	value() = 1
    	if [Last edit in post] >= [date() - 5 weeks]	value() = 2
    	if [Last edit in post] >= [date() - 4 weeks] 	value() = 3
    	if [Last edit in post] >= [date() - 3 weeks] 	value() = 4
    	if [Last edit in post] >= [date() - 2 weeks]	value() = 5
    	if [Last edit in post] >= [date() - 1 weeks]	value() = 6
    Anyone know how to do this?

  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
    We will need just a little more information to give an answer. How do you plan to use this "priority"? Since it is dynamic, you will need to use a query to assign the value but since it is calculated, it does *not* belong in a field in one of your tables.

  3. #3
    Join Date
    Sep 2008
    Posts
    5
    Oh yeah ofcourse sorry.
    First of all I am using access 2003. I have made a post consisting of different fields. Those you need to know are : time of change and priority group.
    That means that when write a new post I want those to be autofilled.
    I have managed the time of change part, but I need to figure out how I can group the posts by last unchanged post to latest unchanged post. (If that doesn't make sense reply and I'll try to change my formulation)

  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'm still a little confused, sorry. What is a "Post"? Is that a Form? When you say "...group the posts by last unchanged post to latest unchanged post...", group where? On a form? On a Report? On a continuous form?

  5. #5
    Join Date
    Sep 2008
    Posts
    5
    Ehm, yeah, sorry I have learn't access using norwegian so my deffinitions might differ from your.

    Field = a place where you can type things like name, number, adress and such

    Name: John Doe
    Number: 555 64647587
    Adress: jumpersroad 3

    Post = All of the fields which John Doe here has typed in is a post

    Form = All posts in one database

    hope that clearifies things

  6. #6
    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
    That helps but I'm still unclear as to what constitutes "last unchanged post to latest unchanged post". What do you mean by unchanged?

  7. #7
    Join Date
    Sep 2008
    Posts
    5
    -_- Well that was a mistake.. I meant to write edited instead of unchanged and what I mean with this is:

    If I change a field in a post I want the field with last edited to change to the present date and then I want to sort all the posts by last edited date to latest edited:

    post with last edited date: 11.04.07 is shown before 12.04.07 and so on...

  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
    DateTime stamping a record is easy! Simply use the BeforeUpdate event of the form to set the field to Now(). This event only occurs when a record is created or changed. A query can be be sorted with an OrderBy clause so bind your form to a query rather than to a table and I believe you will have what you want. Post back if I still have not understood the problem yet.

  9. #9
    Join Date
    Sep 2008
    Posts
    5
    You understood me perfectly this time

    Thanks for the help

  10. #10
    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
    Glad I could help.

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

Similar Threads

  1. Code Trouble?
    By briancb2004 in forum Access
    Replies: 0
    Last Post: 10-08-2008, 04:47 PM
  2. Need Help Getting to Code
    By Snuffles in forum Programming
    Replies: 8
    Last Post: 04-22-2008, 05:25 PM
  3. Navigation Code
    By henryclay in forum Forms
    Replies: 2
    Last Post: 11-15-2006, 09:48 AM
  4. Problem with Code
    By cujee75 in forum Programming
    Replies: 0
    Last Post: 03-10-2006, 02:40 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