Append text to table

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
 
G

Graham R Seach

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top