Ann,
I have to admit I have become intrigued by this thread and have been playing about with the following
Function dBox(strCaption As String) As String
Dim frm As Form, ctl As Control, mdl As Module, lngReturn As Long
BooldBox = False
On Error GoTo Error_dBox
' Create new form.
Set frm = CreateForm
frm.Caption = strCaption
frm.ScrollBars = 0 'Neither
frm.Visible = True
frm.Modal = True
frm.NavigationButtons = False
' Create command button on form.
Set ctl = CreateControl(frm.NAME, acCommandButton, , , , 1000, 1000)
ctl.Caption = "Click here"
' Return reference to form module.
Set mdl = frm.Module
' Add event procedure.
lngReturn = mdl.CreateEventProc("Click", ctl.NAME)
' Insert text into body of procedure.
mdl.InsertLines lngReturn + 1, vbTab & "MsgBox ""Way cool!""" & vbCrLf & "booldbox = true"
Set ctl = CreateControl(frm.NAME, acCommandButton, , , , 2000, 2000)
ctl.Caption = "Exit"
' Return reference to form module.
Set mdl = frm.Module
'Add event procedure.
lngReturn = mdl.CreateEventProc("Click", ctl.NAME)
' Insert text into body of procedure.
mdl.InsertLines lngReturn + 1, vbTab & "DoCmd.Close acForm, me.NAME, acSaveNo"
'Open dBox
DoCmd.OpenForm frm.NAME, acNormal, , , , acDialog
Exit_dBox:
Exit Function
Error_dBox:
MsgBox Err & " :" & Err.DESCRIPTION
Resume Exit_dBox
End Function
In theory this could set up a dialog box, parameter form on the fly (from a global module). So far it fires up a box with 2 buttons, the problem I am having though is that its not staying modal enough for me!!
Let me know if you get any joy.
Cheers
Andy