Application.echo false does not stop code window from

R

Rodney

popping up, is there a way to open it hidden, so it is not
seen then have it close when it is done?
Dim frm As Form, cmdb As Control, str As String
Dim mdl As Module, i As Integer
Application.Echo False
Set frm = CreateForm
frm.RecordSelectors = False
frm.NavigationButtons = False
frm.DividingLines = False
frm.ScrollBars = 0 ' none
frm.PopUp = True
frm.BorderStyle = acDialog
frm.Modal = True
frm.ControlBox = False
frm.AutoResize = True
frm.AutoCenter = True
frm.Caption = "The Current Time is..."
frm.Width = 6000
frm.Section(0).Height = 3000
'
Left, Top, Width,Hieght
Set cmdb = CreateControl(frm.Name, acCommandButton,
acDetail, , , frm.Width / 2 - 450, 1500, 900, 300)
cmdb.Name = "butExit"
cmdb.OnClick = "[Event Procedure]"
cmdb.Caption = "EXIT"
Set mdl = frm.Module
'This line is what causes the code window to open, I just
'want the window to open hidden from the user's view.
i = mdl.CreateEventProc("Timer", "Form")
mdl.InsertLines i + 2, " Me!lblCLock.Caption =
Format(Now, ""dddd, mmm d yyyy, hh:mm:ss AMPM"")" & vbcrlf
mdl.InsertLines i + 3, " Me.Caption = ""The Julian
Date is "" & Format(Now, ""y"") & "", and the Current Time
is..." & vbcrlf
i = mdl.CreateEventProc("Click", "butExit")
mdl.InsertLines i + 2, " Docmd.Close acForm,
Me.Name, acSaveNo" & vbcrlf
frm.TimerInterval = 1000
str = frm.Name
DoCmd.Close acForm, str, acSaveYes
Application.Echo True
DoCmd.OpenForm str, acNormal, , , , acDialog
DoCmd.Close acForm, str, acSaveNo
Do Until SysCmd(acSysCmdGetObjectState, acForm, str) =
0
DoEvents
Loop
DoEvents
DoCmd.DeleteObject acForm, str

Any help at all is appreciated.
Thanks
Rodney
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top