Sub openDetailForm(p_frm As Form, p_frm_detail_name, Optional p_ctrl_col = Null, Optional p_key_col = Null, Optional p_refresh = True, Optional p_win_mode As AcWindowMode = acDialog) Dim rs As Object Dim v_id v_id = p_ctrl_col DoCmd.OpenForm p_frm_detail_name, , , IIf(IsNull(p_ctrl_col), "1=0", p_key_col & " = " & p_ctrl_col), , p_win_mode, IIf(IsNull(p_ctrl_col), Null, p_ctrl_col) If p_refresh Then p_frm.Requery ' Find the record that matches the control. Set rs = p_frm.Recordset.Clone rs.FindFirst p_key_col & " = " & Str(Nz(v_id, 0)) If rs.EOF = False Then p_frm.Bookmark = rs.Bookmark Else DoCmd.GoToRecord acActiveDataObject, , acLast End If End If End Sub
Saturday, March 1, 2014
Related Posts
MS Access Error Exception
Option Explicit
How to Connect to External MS Access File With Password Projected
How to link read only table from external MS Access
MS Access Tables and Relationships
Solution for Property not Found error on BeforeUpdate event
How to Disable Shift By Pass Key in MS Access MDE/ACCDE
How to Replace String With Regular Expression in MS Access
Performance: Filter VS Where Clause
Equivalence DUAL table in MS Access
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.