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

Open New query using VB

Status
Not open for further replies.

jabz

Programmer
Jan 9, 2002
115
US
I want to simply link a button to code that will open a new query in design view. I know that
"DoCmd.RunCommand acCmdNewObjectQuery"
opens the New Query Builder box but I want it to skip over this and open straight into the design view. I know this is simple i'm just not all there today.

Thanks in advance!!
 
DoCmd.OpenQuery queryname[, view][, datamode]

The OpenQuery method has the following arguments.

Argument Description

queryname A string expression that's the valid name of a query in the current database.

view One of the following intrinsic constants:

acViewDesign
acViewNormal (default)
acViewPreview
 
This opens a query yes, but I want it to open a new query not an existing one.
 
docmd.CopyObject ,"BlahBlah",acQuery,"EmptyQuery"
docmd.OpenQuery "BlahBlah", acViewDesign

Note: to make this work, you will first need to create an empty query named EmptyQuery.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top