Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form data not updating (refresh won't) (Access 2k, Win 2K Pro)

    I've met this problem on two dbs recently, and thought I'd check with the loungers...

    On a current project, there is a form/subform for tracking payments. I need to flag when the most recent payment was added in order to raise some kind of flag that a payment is overdue. What I've got so far is a Form/Subform and a query based on the two (linked by the AccountID criteria) with an added column to display the MAX date on the DateRecd field on the subform. This allows me to place a text box on the main form displaying the last date in the list of payments per person, and it does work... but if I make a change (or add a record) in the subform, the change doesn't display in the main form textbox unless I close and re-open the form. Setting up an after update event on the subform field DateRecd as
    <font face="Georgia">
    Me.Parent.Recalc
    </font face=georgia>
    doesn't do anything very noteable; clicking on the menu item to refresh the form doesn't, nor does using the Refresh Form Data button from the toolbox. Any ideas?

    Oh, and BTW: I tried a separate query to get the Max Date and added that to the qryAccount a couple of times and that caused Access to die, so that's why I put the calc field in the qryAccount directly. So, I may be doing something rather illegal...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: form data not updating (refresh won't) (Access 2k, Win 2K Pro)

    The query (and hence the text box on the main form) uses the records as stored. When you tab out of the control bound to the DateRecd field in the subform, the After Update event of the control occurs, but the record isn't saved yet, this occurs when you tab out of the subform record or save it explicitly. So a recalc of the main form has no effect - the modified value of DateRecd hasn't been saved yet. You could put the recalc in the After Update event of the subform. (A forced save of the subform record in the After Update event of DateRecd is probably not desirable).

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: form data not updating (refresh won't) (Access

    well, this does make sense... I put in the recalc code in the after update on the field in the subform but that didn't do anything to the main form text. I was hoping a combination of recalc on the subform and a main form refresh would do the trick... I can re-look to make sure what I think I'm doing is what I actually did <img src=/S/grin.gif border=0 alt=grin width=15 height=15>, if you're of the mind that the two events should get me what I want.

    does 'a forced save on the subform is not desirable' mean 'this is a bad idea in a multi-user enviornment'?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: form data not updating (refresh won't) (Access

    If you force a save, the user will lose some undo capability. When a record is being edited, pressing Esc once undoes the last change in a control, pressing Esc twice undoes the changes in the entire record. If you save, the user can only do the latter.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: form data not updating (refresh won't) (Access

    <font color=red>Hey, DMax worked this time! Seems I forgot to put the '=' in front of it the last time. Problem solved...</font color=red>

    well, do you have any recommendations? I originally tried a DMax on the field but it didn't seem to want to work. but the DSum on another text filed on the main form does update in 'real time' as expected. It's a bit of a problem in terms of user experience, as you might expect. Based on your comments, I put together a macro (aptly named 'Kludge') that closes and opens the form on clicking a button called 'Update' <img src=/w3timages/icons/tongue.gif border=0 alt=tongue width=15 height=15> Which is BAD on several levels...not the least of which is the newly opened form isn't opened to what you saw when you clicked the Update button. I am loathe to improve such a pathetic attempt to get the text box data to work as expected, as the whole idea gives me hives....

    I'll revisit a DMax on this field in the meantime...
    <img src=/S/anigrin.gif border=0 alt=anigrin width=19 height=19>

Posting Permissions

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