Alpha Video Training
Results 1 to 8 of 8

Thread: Change or enter error

  1. #1
    Lloyd Frank
    Guest

    Default Change or enter error

    I have posted this problem before and received several suggestions on correcting it, but none seemed to work.

    I have attached a file with form and files needed to reproduce the error.

    If someone would care to look at it and see if they can find the problem I would appreicate the help.

    I know I have missed something but don't know what.
    TIA

    Lloyd

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Change or enter error

    Lloyd, clearing the onDepart script from the Customer_ID field did not solve the problem. I think the trouble lies in the OnSave script for the form itself. I had good luck with the following version, which I've commented to show the changes from your original.

    Hope this helps.

    -- tom


    'OnSave script for Payment Entry Form
    ' As script begins record has just been saved

    'Form is based on set. Tables in the set are open.
    ' But no data entry is pending (was just saved)


    DIM ax_choice as C
    DIM ax_response as N
    DIM ax_dialog as P


    ON ERROR GOTO ax_error_trap
    DIM ax_error_trap_desc as C
    DIM ax_error_trap_offset as C
    DIM ax_error_trap_msg as C
    DIM ax_error_trap_response as N

    ax_error_trap_desc = "Action Script"
    ax_error_trap_offset = "0"
    ax_error_trap_desc = "Inline Xbasic"
    ax_error_trap_offset = "1"
    dim t as p
    dim tbl as p
    dim pmt as n
    t=table.current() 'points to parent table in set

    'tbl=table.open("billing table") 'wrong. Table is already open.
    'If you open it again, Alpha Five will give
    'it a different alias...
    'so, point to it like this...
    tbl=table.current(3) 'billing table is in 3rd outline slot in the set

    tbl.index_primary_put("customer_id")
    tbl.fetch_find(t.customer_id)
    tbl.change_begin()

    pmt=t.total_paid-t.sp_assess
    if tbl.ninety_day>0 .and. pmt-tbl.ninety_day>=0 then
    pmt=pmt-tbl.ninety_day
    tbl.ninety_day=0
    elseif tbl.ninety_day>0 then
    tbl.ninety_day=tbl.ninety_day-pmt
    pmt=0
    elseif tbl.ninety_day0 .and. pmt-tbl.sixty_day>=0 then
    pmt=pmt-tbl.sixty_day
    tbl.sixty_day=0
    elseif tbl.sixty_day>0 then
    tbl.sixty_day=tbl.sixty_day-pmt
    pmt=0
    elseif tbl.sixty_day0 .and. pmt-tbl.thirty_day>=0 then
    pmt=pmt-tbl.thirty_day
    tbl.thirty_day=0
    elseif tbl.thirty_day>0 then
    tbl.thirty_day=tbl.thirty_day-pmt
    pmt=0
    elseif tbl.thirty_day

  3. #3
    Lloyd Frank
    Guest

    Default RE: Change or enter error

    Tom

    Thanks for the help.
    It seems to work except I need to stay in the form for continous enter. The form.close() takes me out of the form instead of going to a new blank form. Is there a way around this.

    Lloyd

  4. #4
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default RE: Change or enter error

    Lloyd,

    Put a "'" before the parent_close.form(). This will cause the line not to be read and you can see how that works.

    kenn

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Change or enter error

    Lloyd, after the save do you want the form to show the record just saved, or do you want it to automatically begin a new record with fields blanked out on the form? Will make a difference.

    I closed the form because you began the new record in an onInit event for the form. This fires only one time, when the form is first initialized... Usually when folks start the new record in this fashion it means they only want the user to work on one record at a time... closing the form between each... Otherwise, the next new record doesn't start automatically.

    Do you want a new record to start automatically after the last one is saved?

    -- tom

  6. #6
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Change or enter error

    If continuous entry of new records is what you want, change the last part of the OnSave event for your form to:

    'tbl.close() 'wrong. Cannot close it since form is based on it.
    'parentform.close() 'so, close form instead. This closes the set.
    parentform:Tables:Payments.enter_begin(HONOR_FIELD_RULES) 'begin new record
    parentform.resynch() 'resynch form
    sys_send_keys("{Tab}") 'move focus to customer_id field

    END

  7. #7
    Lloyd Frank
    Guest

    Default RE: Change or enter error

    Tom

    I do want continuous entry. I played around with the origional scripts and it seems that if I comment out the line "payments->complex_code=left(payments->customer_id,i-1)" ,which is attached to the customer_id fields OnDepart event then the original scripts work the way I think they should. When the comment is removed then the errors occur whem leaving the last field. That is why I thought the problem was with the script on the ondepart event.

    Lloyd

  8. #8
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Change or enter error

    Did you check to see whether the billing history table was properly updated...

    It looked to me as though the onSave script was quietly failing... giving you the impression that it was working correctly. I saw nothing wrong with the onDepart script for customer_id.

    try changing the script as shown in my previous post, to do continuous entry.

    -- tom

Similar Threads

  1. change table in enter mode
    By aau Ching in forum Alpha Five Version 5
    Replies: 4
    Last Post: 12-05-2003, 02:48 PM
  2. Table not in change or enter mode
    By Martin in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-12-2002, 12:39 PM
  3. Ok in Change mode but not Enter
    By Robert Picard in forum Alpha Five Version 4
    Replies: 11
    Last Post: 05-19-2001, 09:13 PM
  4. Change / Enter Mode BUG!!??
    By forskare in forum Alpha Five Version 4
    Replies: 0
    Last Post: 09-15-2000, 06:38 AM
  5. Enter or Change Mode
    By forskare in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-13-2000, 06:43 PM

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
  •