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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound form or acCmdNewObjectAutoForm opens form in design View

Status
Not open for further replies.

qmacg

Technical User
Aug 20, 2001
47
US
I Need to create an Unbound form or figure out how to open a form in design view using the command acCmdNewObjectAutoForm. When the form is displayed with the following code, it immediately opens it up in edit view...:

DoCmd.SelectObject acTable, strTable, True
DoCmd.RunCommand acCmdNewObjectAutoForm

I want to open it in Design view similar to when you use the form Wizard to create a blank unbound form or assigns a recordsource to the form, but displays the form in Design view. Any help would be appreciated...
 
Can you provide a little more info as to what you are trying to do (in other words, why you would need that)? There may be other options available, depending on what you are ultimately trying to accomplish.

Bob Larson
Access MVP
Free Access Tutorials and Samples:
 
How are ya qmacg . . .

The following:
Code:
[blue]   DoCmd.OpenForm "FormName", acDesign[/blue]
... opens a form in design view.

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I just wanted to dynamically create a form through VBA code.
When I use the code below it dynamically creates a form for me, but I want it to appear in design view, not form view.

DoCmd.SelectObject acTable, strTable, True
DoCmd.RunCommand acCmdNewObjectAutoForm
 
look in the help file "creatform"
Remarks
You can use the CreateForm method when designing a wizard that creates a new form.

The CreateForm method opens a new, minimized form in form Design view.

If the name you use for the formtemplate argument isn't valid, Visual Basic uses the form template specified by the Form Template setting on the Forms/Reports tab of the Options dialog box.

Example
This example creates a new form in the Northwind sample database based on the Customers form, and sets its RecordSource property to the Customers table. Run this code from the Northwind sample database.

Sub NewForm()
Dim frm As Form

' Create form based on Customers form.
Set frm = CreateForm( , "Customers")
DoCmd.Restore
' Set RecordSource property to Customers table.
frm.RecordSource = "Customers"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top