Access VBA: Syntax error on delete statement

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I am getting a syntax error on the delete statement in the the code below
Public Sub Clear_Online_Table()
 
    Dim oSQL As String
    
    On Error GoTo EH
    
    Set con = New ADODB.Connection
    
    con.Open "Provider=SQLOLEDB;Data Source=196.220.43.247,1444;Network Library=DBMSSOCN;Initial Catalog=lesedi_hr;User ID=Grham;Password=maha34;"

    Set cmd = New ADODB.Command
    
    oSQL = "Delete * From People"
    
    With cmd
        .CommandText = oSQL
        .CommandType = adCmdText
        .ActiveConnection = con
        .Execute
    End With
    
    
    Set cmd = Nothing
    Set con = Nothing
    
    Exit Sub
    
EH:
    
    MsgBox Err.Description
    
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
  try
    oSQL = "Delete  From People"
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Fantastic. Worked!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial