Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32

    Question Unanswered: can't requery subform

    Hello,

    please help me solve my problem...
    I have a mainform with one subform, which (subform) is based on a similar query: "SELECT a,b,c,stop FROM table WHERE stop=false". In the "On Delete" event of the subform I placed the following code:

    Cancel = True
    If Me.SelHeight = 1 Then
    Me.stop = True
    DoCmd.RunCommand acCmdSaveRecord
    Me.Parent.subformname.Requery
    End If

    ...because I don't want any deleted records - only "stopped". After executing this code (from

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    I thing you have a problem because the users can select more than one record at the same time and then your code don't work fine.
    My be is better set the property AllowDeletions to No, show in the subform the field stop and make that the users activate the stop.
    Use a code in event AfterUpdate for see that situacion and make the requery.
    Saludos
    Norberto

  3. #3
    Join Date
    Jan 2004
    Location
    Poland
    Posts
    3

    Talking Re: can't requery subform

    Try:
    Me.Parent.subformname.Refresh

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    You have the Focus in the Subform that is the problem with the requery of the main form.
    Prube with this:
    Me.Parent.subformname.SetFocus
    Me.Requery
    Saludos
    Norberto

  5. #5
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Thank's for your answers

    Norberto: Yes, my users can select more than one row, but in this case my procedure is not executing, cause the "If Me.SelHeight = 1 Then ... End If" in my code... The other problem is I don't want my users to know what is happening on the "background" - for him, this must look like simple deletion of a record.

    blablast: the "refresh" method raises an error message: "Object doesn't support this property or method"

  6. #6
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Originally posted by Norberto
    You have the Focus in the Subform that is the problem with the requery of the main form.
    Prube with this:
    Me.Parent.subformname.SetFocus
    Me.Requery
    No, my focus is still remaining on subform and I need requery the subform, not the mainform!

  7. #7
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Originally posted by sztomi
    Thank's for your answers

    Norberto: Yes, my users can select more than one row, but in this case my procedure is not executing, cause the "If Me.SelHeight = 1 Then ... End If" in my code... The other problem is I don't want my users to know what is happening on the "background" - for him, this must look like simple deletion of a record.

    blablast: the "refresh" method raises an error message: "Object doesn't support this property or method"
    Ok .... now i understand what you want.
    For the requery make this:
    You have the Focus in the Subform that is the problem with the requery of the main form.
    Prube with this:
    Me.Parent.subformname.SetFocus
    Me.Requery
    Saludos
    Norberto

  8. #8
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Originally posted by Norberto
    Ok .... now i understand what you want.
    For the requery make this:
    You have the Focus in the Subform that is the problem with the requery of the main form.
    Prube with this:
    Me.Parent.subformname.SetFocus
    Me.Requery
    Thus once again: I have my custom deletion code in the On Delete event of the SUBFORM, thus I need requery the subform! With the above code I get a very exciting error: "Reserved Error", but never mind, because it requeries the main form, that I don't need....

  9. #9
    Join Date
    Jan 2004
    Location
    Poland
    Posts
    3
    Originally posted by sztomi
    Thus once again: I have my custom deletion code in the On Delete event of the SUBFORM, thus I need requery the subform! With the above code I get a very exciting error: "Reserved Error", but never mind, because it requeries the main form, that I don't need....
    So , can you use just:
    Me.Requery
    or try
    Me.Refresh and next Me.Repaint
    ???

  10. #10
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    This must work:

    Forms![mainform]![subform].Requery
    Saludos
    Norberto

  11. #11
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Originally posted by blablast
    So , can you use just:
    Me.Requery
    or try
    Me.Refresh and next Me.Repaint
    ???

    Hmmm, it's very interesting: after my code executes, if I manually place a focus on a control on the main form, then select Refresh from the Access' Records menu, the stopped row (on the subform) is not showing already! But if I code this step into my procedure

    Me.Parent.somecontrol.setfocus
    Me.Parent.Refresh

    ... it doesn't help! Neither the methods Repaint or Requery...

  12. #12
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Originally posted by Norberto
    This must work:

    Forms![mainform]![subform].Requery
    not working

  13. #13
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Now is a question of honor send an sample base in Access 97 format
    for see what is the problem.
    Saludos
    Norberto

  14. #14
    Join Date
    Jan 2004
    Location
    Slovakia
    Posts
    32
    Originally posted by Norberto
    Now is a question of honor send an sample base in Access 97 format
    for see what is the problem.
    Sorry, I can't convert my database to Access 97's format, during the conversion it gives me an error message "Invalid filed data type". So the attached db2.mdb is in Access 2000 format (converted from Access 2002).
    Attached Files Attached Files
    (sz)Tomi

  15. #15
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    I have Access 97 not Access 2000, then i can't read that file.
    Saludos
    Norberto

Posting Permissions

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