If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Requer/Refresh Issue
Greeting from Iraq
I have a main form (frmDO) with a subForm (frmDODetail) where the sub control name is sfrmDODetail. The subform is a datasheet. When I double click on sfrmDODetail and edit form is displayed (frmEditDODetail). When I save the changes in the edit form (frmEditDODetail) I want the sub form (sfrmDODetail - frmDODetail) to display the edits/changes/ additions made by the user. I have tried numerous different ways (many suggested in this group) to make the sub form (sfrmDODetail - frmDODetail) requery. I have tried Forms! etc, Dim frm as FORM_frmDODetail. I have spent 4 - 5 hours trying every different combination. At one point I had a variation of Forms! working. Then out of the blue the method no longer worked. Please Help |
#2
|
|||
|
|||
Requer/Refresh Issue
the trick is to requery the subform when you close the edit form. Use
the edit form CLOSE event forms!mainform!subform_controlname.requery DoEvents WHERE mainform is the name of the main form subform_controlname is the Name property of the subform control Also, before you open the edit form, make sure you save the current record if it is 'dirty' (needs to be saved) if me.dirty then me.dirty = false Alternately, you can open the form with the dialog parameter and then requery the control in the same code that opens the edit form assuming you are specifying a WHERE parameter as well: DoCmd.OpenForm "Formname", , , "[somefield]='something'", , acDialog or, if you do not have a WHERE parameter DoCmd.OpenForm "Formname", , , , , acDialog ~~~ DoEvents ~~~ DoEvents is used to make VBA pay attention to what is currently happening and look to see if the OS (Operating System) has any requests -- including the keyboard ie: if you have a loop and want to be able to BREAK it with CTRL-BREAK, put DoEvents into the loop DoEvents will also update values written to a form by a general procedure or code behind another form or report A DoEvents is done when you use MsgBox, or are stepping through code (since it has to pay attention to the keyboard) It is a good way to say, "Wake Up!" Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * rm wrote: Greeting from Iraq I have a main form (frmDO) with a subForm (frmDODetail) where the sub control name is sfrmDODetail. The subform is a datasheet. When I double click on sfrmDODetail and edit form is displayed (frmEditDODetail). When I save the changes in the edit form (frmEditDODetail) I want the sub form (sfrmDODetail - frmDODetail) to display the edits/changes/ additions made by the user. I have tried numerous different ways (many suggested in this group) to make the sub form (sfrmDODetail - frmDODetail) requery. I have tried Forms! etc, Dim frm as FORM_frmDODetail. I have spent 4 - 5 hours trying every different combination. At one point I had a variation of Forms! working. Then out of the blue the method no longer worked. Please Help |
Thread Tools | |
Display Modes | |
|
|