Option Compare Database Option Explicit ' _MC means ModuleCode - code located in a module ' ' This routine accepts the name of the dialog box (form) ' and a single ID value. It returns returns the original value ' if either Esc or Cancel is pressed, otherwise, it returns ' the new value Public Function OpenDialogBox_Int_MC _ (DialogName As String, CurrentValue As Integer) As Integer Dim ResultFlag As String DoCmd.OpenForm DialogName, , , , , acDialog, CurrentValue ResultFlag = Forms(DialogName).Form.Tag If ResultFlag <> Str(-1) Then ' Test that OK was pressed OpenDialogBox_Int_MC = ResultFlag Else OpenDialogBox_Int_MC = CurrentValue End If DoCmd.Close acForm, DialogName End Function ' This routine accepts the name of the dialog box (form) ' and a single String value. Public Function OpenDialogBox_Str_MC _ (DialogName As String, CurrentValue As String) As String Dim ResultFlag As String DoCmd.OpenForm DialogName, , , , , acDialog, CurrentValue ResultFlag = Forms(DialogName).Form.Tag If ResultFlag <> Str(-1) Then ' Test that OK was pressed OpenDialogBox_Str_MC = ResultFlag Else OpenDialogBox_Str_MC = CurrentValue End If DoCmd.Close acForm, DialogName End Function