This is a custom Msgbox where I can pass the captions and get the result.
It works but I cannot understand why I need to IsNull check.
This often is the case on try 1 (just after writing the code). Even with Openargs passed it shows up as Null.
You have to close the Form and open it a second time, then it's ok.
But also in this case the Form_Load event seems to run again after the Form is Hidden/closed.
Why is this ?
I also tried Form_Activate instead of Form_Load but that doesn't even run. Should it ?
Thanks
--
It works but I cannot understand why I need to IsNull check.
This often is the case on try 1 (just after writing the code). Even with Openargs passed it shows up as Null.
You have to close the Form and open it a second time, then it's ok.
But also in this case the Form_Load event seems to run again after the Form is Hidden/closed.
Why is this ?
I also tried Form_Activate instead of Form_Load but that doesn't even run. Should it ?
Thanks
--
Code:
Public Sub cmdNotes_Click()
Dim fCaption As String
Dim Button1Caption As String
Dim Button2Caption As String
Dim a As Integer
fCaption = "Move last bracketed text in Title to Notes" & Chr$(1)
Button1Caption = "Whole Disk" & Chr$(1)
Button2Caption = "This Record Only" & Chr$(1)
DoCmd.OpenForm "frmMsgbox2", acNormal, , , , acDialog, fCaption & Button1Caption & Button2Caption
a = Form_frmMsgBox2.Result
DoCmd.Close acForm, "frmMsgbox2"
MsgBox a
End Sub
Code:
Option Compare Database
Option Explicit
Public Answer As Integer
Private Sub btn1_Click()
Answer = 1
Me.Visible = False
End Sub
Private Sub btn2_Click()
Answer = 2
Me.Visible = False
End Sub
Sub Form_Load()
If Nz(Me.OpenArgs) <> "" Then
Me.Caption = Form_frmCDMain!Title
Me.lblPrompt.Caption = Split(Me.OpenArgs, Chr$(1))(0)
Me.btn1.Caption = Split(Me.OpenArgs, Chr$(1))(1)
Me.btn2.Caption = Split(Me.OpenArgs, Chr$(1))(2)
End If
End Sub
Public Property Get Result() As Integer
Result = Answer
End Property