If the value entered is outside the expected range, a PopUp form is opened, and values are passed using OpenArgs. These include the name of the main form, the name of the control, the actual value entered and a 'plain English' name of the type of blood test. The popup form displays the value and plain English name, and asks the user if they are sure they meant that specific value. The user has two command buttons, Accept which simply closes the PopUp, or Reject which returns the focus to the control on the main form.
I am using Access 2007.
The problem is I can't seem to return the focus to the main form. The conventional way to achieve this is:
Expand|Select|Wrap|Line Numbers
- Forms!TheFormName!ControlName.SetFocus
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Private strFormName As String 'The calling form
- Private strControlName As String 'The calling control, focus may be returned here
- Private strValue As String 'The actual value
- Private strValueType As String 'The type of value, such as ACT or Hb
Expand|Select|Wrap|Line Numbers
- Private Sub Form_Load()
- strFormName = Split(OpenArgs, "~")(0)
- strControlName = Split(OpenArgs, "~")(1)
- strValue = Split(OpenArgs, "~")(2)
- strValueType = Split(OpenArgs, "~")(3)
- lblTypeOfValue.Caption = strValueType
- lblValue.Caption = strValue
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub cmdNo_Click()
- Forms(strFormName).Controls!strControlName.SetFocus
- DoCmd.Close acForm, Me.Name, acSaveNo
- End Sub
I have tried declaring fldMyField as a Field in stead of strControlName, but that did not work.
Any ideas where I am going wrong? Thanks for your help.