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

Where do I type the SQL commands?

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
The gui is fine but sometimes I want to type raw sql or ddl. In Oracle and sql server that is the norm. How do I get an sql prompt for my MS Access .mdb???
 


Hi,

Design a query - open the SQL in Design mode.

Skip,

[glasses] [red]Be Advised![/red]
Alcohol and Calculus do not mix!
If you DRINK, don't DERIVE![tongue]
 
Should be on the left-most button (which is a drop down button). Depending on the version of access and the query type, you should at least have Design, Datasheet, and SQL.
 
What about DDL? I want to write create table statements and set foreign keys using a pure command-line interface.
 
The query window, even in the SQL view pane, allow only ONE statement at a time.
You may consider playing with the DoCmd.RunSQL method in VBE.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You could create your own sub to do this in no time.

This is a very primitive version...
Code:
Sub MySQLBox()
On Error Goto ViewError
Dim strSQL as String
Do until strSQL = "q"
    strSQL = inputbox("Enter the SQL to execute. q to Quit","SQL")

    DoCmd.RunSQL strSQL
Loop
ProcExit:
    Exit Sub
ViewErr:
    Msgbox Err.Description
    Resume Next
End Sub

The early bird gets the worm, but the second mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top