Sql

aziz rasul

Active member
Local time
Today, 08:30
Joined
Jun 26, 2000
Messages
1,935
Can anyone show me how to create a select query using SQL and running it? I know I can't use DoCmd.RunSQL?
 
?

This won't work?:

Public Sub DoSQL()

Dim SQL As String

SQL = "UPDATE Employees " & _
"SET Employees.Title = 'Regional Sales Manager' " & _
"WHERE Employees.Title = 'Sales Manager'"

DoCmd.RunSQL SQL

End Sub
 
The best way is to create a DataSheet form Queries and Tables are not the best place for user interaction. Set the Record Source = to the Query/SQL Statement. Or you could set the Forms RecordSet property = to the Select statment opened as a RecordSet (ADO).

But if you must then create a temporary QueryDef and use Docmd.OpenQuery
 

Users who are viewing this thread

Back
Top Bottom