Append text to table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Another Question

I want to crate a log of activities occuring via my vba cube. I have a table called 'Log' which I want to write this information too. How do i do it

Function WriteLog(MyText, myTable, mySpec, myFile, myStatus
'creates log of file importatio
Dim myDat
myDate = Now(
' need to append record (MyText, myTable, mySpec, myFile, myStatus, myDate) to table (Log)
End Function
 
Marcus,

Despite the fact that you declared all the arguments as Variant, in the
following code, I assumed all arguments to be String, except myStatus, which
I assumed to be numeric.

Function WriteLog(MyText, myTable, mySpec, myFile, myStatus) As Boolean
'creates log of file importation
Dim sSQL As String

On Error Resume Next
sSQL = "INSERT tblSomeTable (myText, myTable, mySpec, myStatus, myDate)
" & _
"VALUES (""" & myText & """,""" & myTable & """,""" &
mySpec & """," & myStatus & ",#" & Now() & "#)"

CurrentDb.Execute sSQL, dbFailOnError
WriteLog = (Err.Number = 0)
End Function

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


marcus. said:
Another Question!

I want to crate a log of activities occuring via my vba cube. I have a
table called 'Log' which I want to write this information too. How do i do
it?
 
Back
Top