K
Karen
I want to insert a record into the database when an outlook form is opened,
but it doesn't work.
I discover that the SQL query works for SELECT statement but does not work
in INSERT or UPDATE statement.
Is this normal? thanks
' Doesn't work..
Function Item_Open
Set myDB = CreateObject("ADODB.Connection")
strConnection = "Server=192.168.5.33;DSN=Book;Database=Book;"
strConnection = strConnection & "UID=tester;PWD=test"
myDB.Open strConnection
strSQL = "INSERT INTO Sheet1 ([book1]) VALUES ('LOTR')"
Set myRS = myDB.Execute(strSQL)
End Function
' works perfectly
Function Item_Open
Set myDB = CreateObject("ADODB.Connection")
strConnection = "Server=192.168.5.33;DSN=Book;Database=Book;"
strConnection = strConnection & "UID=tester;PWD=test"
myDB.Open strConnection
strSQL = "SELECT * From Sheet1 Where ID=3"
Set myRS = myDB.Execute(strSQL)
MsgBox myRS.fields("book1")
End Function
but it doesn't work.
I discover that the SQL query works for SELECT statement but does not work
in INSERT or UPDATE statement.
Is this normal? thanks
' Doesn't work..
Function Item_Open
Set myDB = CreateObject("ADODB.Connection")
strConnection = "Server=192.168.5.33;DSN=Book;Database=Book;"
strConnection = strConnection & "UID=tester;PWD=test"
myDB.Open strConnection
strSQL = "INSERT INTO Sheet1 ([book1]) VALUES ('LOTR')"
Set myRS = myDB.Execute(strSQL)
End Function
' works perfectly
Function Item_Open
Set myDB = CreateObject("ADODB.Connection")
strConnection = "Server=192.168.5.33;DSN=Book;Database=Book;"
strConnection = strConnection & "UID=tester;PWD=test"
myDB.Open strConnection
strSQL = "SELECT * From Sheet1 Where ID=3"
Set myRS = myDB.Execute(strSQL)
MsgBox myRS.fields("book1")
End Function