What I am doing wrong?

  • Thread starter Thread starter Joao
  • Start date Start date
J

Joao

I have this code:

.....
Set BD = CurrentDb
.....

Public Function funcRunSQL(strCmdSQL As String)

Set rstSQL = BD.OpenRecordset( _
strCmdSQL, dbOpenDynaset)

rstSQL.Update

rstSQL.Close
BD.Close

End function


Calling the func:

SQLString = "UPDATE Processos SET Mes = 6, Ano = 1924 WHERE NrSubs = 87564;"

funcCorrerSQL SQLString

I get an error on the rstSQL SET:
"Error : 3219 Invalid Operation"

Anyone????
I think my DB isn't lockedwriting...
 
What are you trying to do? If you are trying to execute the query, you
might be able to use

CurrentDb().Execute strCmdSQL

That would be the entire procedure.

Public Function funcRunSQL(strCmdSQL As String)
CurrentDb().Execute strCmdSQL
End function



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Back
Top