Hi Leo
Thanks for this. I got there in the end.
One last question.
Does the # indicate it is numeric?
thx.
--
Paj
On Fri, 19 Jul 2002 15:32:15 -0400, "Leo Walter"
Quote:
> strSQL = "UPDATE calls SET [closedetails]='"
> strSQL = strSQL & txtCloseDetails.Text
> strSQL = strSQL & "', [dateclosed]=#"
> strSQL = strSQL & txtdateclosed.text
> strSQL = strSQL & "# WHERE [callid]=" & CInt(txtSearchCallID.Text)
>> Hi
>> how to update a table using ado.
>> I wish to update several fields at once.
>> Would like a good working example if possible.
>> I know how to update 1 field but not more than 1.
>> This works for one field:
>> ' Set the variables
>> Dim adoConn As New ADODB.Connection
>> Dim adoCmd As New ADODB.Command
>> Dim strConn As String, strSQL As String
>> ' Open a Connection object
>> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
>> strConn = strConn & "c:\mydb.mdb"
>> adoConn.ConnectionString = strConn
>> adoConn.Open
>> ' Define a query string
>> strSQL = "UPDATE calls SET [closedetails]='"
>> strSQL = strSQL & txtCloseDetails.Text
>> strSQL = strSQL & "' WHERE [callid]=" & CInt(txtSearchCallID.Text)
>> ' Set up the Command object
>> adoCmd.CommandText = strSQL
>> adoCmd.CommandType = adCmdText
>> adoCmd.ActiveConnection = adoConn
>> adoCmd.Execute
>> ' Tidy up
>> Set adoCmd = Nothing
>> adoConn.Close
>> Set adoConn = Nothing
>> How can I add to this to also update the database field: _dateclosed_
>> from the text control _txtdateclosed.text_
>> thanks
>> --
>> Paj