Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to suppress VB editor when using CreateForm

Status
Not open for further replies.

rr191

IS-IT--Management
Jun 6, 2002
21
US
I am using the CreateForm function to create a new form based on a template that has controls (buttons) with VB code behind them. Everytime the CreateForm function is called, it creates the form and opens the VB editor window and leaves it open. I've tried turning echo off, but it must not apply to the VB editor.

I would like to be able to create the form without the editor appearing. This did not happen in Acc97, but has been happening in Acc2002 and Acc2003. Any ideas?

-- Rob
 
Microsofts documentation states that this function opens the form designer in a minimized view. The only way that I have found to get around it doesn't really get around it...

Code:
Public Function CreateNewForm()
  Dim oFrm as Form
  Set oFrm = CreateForm(FormTemplate:="frmTemplate")
  Application.Forms.Item(oFrm.Name).Visible = False
End Function

Attach your macro to the code with RunCode.

It simply hides the form designer. The forms will show up when you use Window -> Unhide. When Access closes it will ask to save the forms.

HtH,

Rob

-Focus on the solution to the problem, not the obstacles in the way.-
 
Rob --

Perhaps I wasn't clear. Basically, this is what is happening in my code:

...
Application.Echo False
'(this keeps the form designer from displaying)
Set tmpForm = CreateForm(, "frmMap")
'(Create the form)
Set ctl = CreateControl(tmpFormName, acCommandButton, acHeader, , , 180, 120, 1320, 360)
ctl.Caption = "Close"
Set tmpModule = tmpForm.Module
lngReturn = tmpModule.CreateEventProc("Click", ctl.Name)
tmpModule.InsertLines lngReturn + 1, vbTab DoCmd.Close , , acSaveNo"
'(this places a "close" button on the form that will not save the form on exit.)

At this point, the form is still hidden, but the Visual Basic Editor window opens and stays open with the code I just inserted into the close button. I would like to suppress this from happening. It didn't happen in Access 97 since there was no VB editor. But, I need to update the application to work in Access 2002/2003 due to a pending upgrade at my firm.

Any help would be appreciated!

-- Rob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top