Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012

    Unanswered: requery does not work with new records


    I have a form (single form view) with a subform (Continuous Forms view) on it. When the user changes the value of a listbox, the data in the subform is changed through vba code. Afterwards I do a requery to show the new data to the user. All works fine, except when you are in a new record. When you are in a new record, the first time you choose something, nothing changes on the screen (the tables are changed correctly). Afterwards all works fine. In 'old' records all works from the first second. (I tried on 2 different computers, same result)

    I looked quit some time on the internet and could not find anything. Ended up using both next lines (in the hope togheter they work)
    remitos=name main form; Subformulario Movimientos= name of subform-control

    Forms!Remitos.Form![Subformulario Movimientos].Form.Requery
    Forms!Remitos.Form.[Subformulario Movimientos].Form.Requery

    ANyone any suggestions?

  2. #2
    Join Date
    Apr 2005
    Zagreb - Croatia
    I Think !
    If you are in th NEW record, in that case the record is not entered yet.

  3. #3
    Join Date
    Feb 2012
    Thx M-stef, with your help I found it.
    putting the line "if me.dirty then me.dirty=false" solved it!

    Thank you very much

  4. #4
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    As you've discovered, before referring to a Field in a Record you have to first make it a Record, which is to say Save it!

    Being an old hand to VB and VBA, I usually use

    If Me.Dirty Then Me.Dirty = False

    but you could also use

    DoCmd. RunCommand acCmdSaveRecord

    You need to delete the Space after DoCmd. If we post a DoCmd command, this web site assumes that it's a email address and for security reasons places asterisks in place of the [dot] and next three characters.Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Tags for this Thread

Posting Permissions

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