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
|
|||
|
|||
Find specific record
Currently have a form "frmMainform" with subform "frmSubForm" where/when
there is no data in the subform I CLICK on a button to invoke a "frmPopUpForm" to add info to the subform table which is bound. After close, the requery statement takes place and requeries but returns the "frmMainForm" and the related "frmSubform" to the first record of the "frmMainForm". How do I stay/return with/to the same record I was viewing when I invoked the "frmPopUpForm"? I posted this once before but lost the answer. I have attempted to solve by myself using logical (in my mind) programming but get stuck as follows. The following code is in the AfterUpdate event of the popup form. I added the primitive error handling just to stop the entire thing freeeeezing up. The code runs as I would expect until the dotted line. The variable strFindRec holde the "value" through the requery (I think) since the debug.Print statement shows the correct value in the Immediate window of the VBA editor. Why does the FindRecord statement foul/fowl up? Private Sub Form_AfterUpdate() On Error GoTo Err_Hand: Dim strFindRec As String strFindRec = Me![SISItemCode].Value Forms![frmMaterialMasterMain].Requery Debug.Print strFindRec Forms![frmMaterialMasterMain]![SISItemCode].SetFocus ------------------------------------------------------------------------------------------- DoCmd.FindRecord strFindRec, acAnywhere, , acSearchAll, , acAll, False Err_Hand: DoCmd.GoToRecord , , acFirst End Sub |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find Specific Record using 2 controls | timsken | Using Forms | 3 | August 2nd, 2005 03:35 AM |
'Search' box to find a record | Jane | Using Forms | 1 | September 26th, 2004 09:25 AM |
find last modified record | zealousagenda | Running & Setting Up Queries | 1 | September 24th, 2004 09:41 AM |
find and replace | ladyinred | General Discussion | 14 | August 12th, 2004 09:35 PM |
Find Record in Subform | Katherine R | General Discussion | 7 | June 26th, 2004 03:22 PM |