Alpha Video Training
Results 1 to 12 of 12

Thread: Default Change Date Field

  1. #1
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default Default Change Date Field

    I have a record of many voters in our database; I have 2 fielfields one for Adddate, the other for Change date. The change date field will not change when I write a field field rule DATE(), but does when data is entered. Is there away to write a field rule so that when some data is changed in a record, that the change date field will automatically change to that date by using DATE()? Any help should be appreciated.

  2. #2
    Jim Rowlen
    Guest

    Default RE: Default Change Date Field

    You could try something like the following in the form onSave event (first save will have same date as when record is saved if set up correctly)

    TblePtr = table.current(1) ' change number to be position if in set
    TblPtr.change_begin()
    TblPtr.ChangeDate = DATE()
    TblPtr.change_end(.T.)

    You can go a bit further and also put in the time the record was saved/changed and, if you have User IDs which are used when a user log in to the network (and maintained on the user's system), the ID of the last user to edit a record.

  3. #3
    Jim Rowlen
    Guest

    Default RE: Default Change Date Field

    TblePtr = table.current(1)

    should read

    TblPtr = table.current(1)

  4. #4
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field

    Hi Jim

    Thanks a lot for the information; I am just learning how to write events.

    Nip Lewis

  5. #5
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field

    I guess I did something wrong with the info you gave me or I wrote the script in the wrong place. I have a "CHDDATEFIELD" in the form of my table called Derryvtr alonalong with Name, Address, Party, and if I change any of them the date did not change. Iguess I need to take some course on this to make sure I am doing it correctly. Thanks for taking the time to help me.

    Nip Lewis
    Derry, NH

  6. #6
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Default Change Date Field

    Nip:

    Did you put Jim's code on your form's on_save event?
    Did you change his field name to match your own?
    Resynch() your field (or the whole form, although it is a bit slower) at the end.

    That's what comes to mind at first thought.

    Bill

  7. #7
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field

    Hi Bill

    Thanks for the reply; I am doing something fundamentally wrong as when I try to type the info, it goes in a straight line and the enter key does not drop down a line. I guess I need more study. I got the idea and where to start in the form layout, but cannot get it to work.

    Thanks again for your help.

    Nip Lewis
    Derry, NH

  8. #8
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field


    Hi Bill

    I did try Jim's code, etc and your suggestion.
    I am doing something basically wrong as it will not type correctly in the box in the as onSave Event. I guess I am missing something in trying to do this. I do have Alpha5 Ver4 and update patches included.

    I appreciate your help in this problem.

    Nip Lewis
    Derry, NH

  9. #9
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Default Change Date Field

    *Where* are you typing into? On the form? In the action scripting screen? In the code editor?

    Something simple is wrong.

    Bill

  10. #10
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field

    Hi Bill

    I finally got it to work and thanks very much for your help.

    Nip Lewis

  11. #11
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default RE: Default Change Date Field

    Nip,

    I think that you may be trying to write diectly into the code editor without first selecting InlineXbasic.

    Michael

  12. #12
    Member
    Real Name
    Nip Lewis
    Join Date
    Jul 2000
    Location
    Derry, NH
    Posts
    155

    Default RE: Default Change Date Field

    Hi Jim

    Thanks for the reply; I was doing it wrong and finally got it to work.
    Thanks

    Nip Lewis

Similar Threads

  1. Change default date on form
    By Bill Clementz in forum Alpha Five Version 6
    Replies: 2
    Last Post: 06-20-2005, 07:27 AM
  2. Default a date field to NULL or EMPTY...
    By Hansolo in forum Alpha Five Version 6
    Replies: 44
    Last Post: 02-07-2005, 01:03 PM
  3. Current date required in table field default form
    By David Morgan in forum Alpha Five Version 6
    Replies: 2
    Last Post: 01-23-2005, 12:43 PM
  4. How to change the 'Default form' ?!?
    By Una Chi in forum Alpha Five Version 6
    Replies: 5
    Last Post: 01-22-2005, 04:23 AM
  5. Date Change Field Rule
    By dparkins in forum Alpha Five Version 5
    Replies: 14
    Last Post: 10-27-2003, 10:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •