by "Ian Davies" <ian.dandav@[EMAIL PROTECTED]
>
Apr 12, 2005 at 03:14 PM
Thanks to all of you, that worked
Ian
"Ian Davies" <ian.dandav@[EMAIL PROTECTED]
> wrote in message
news:EHP6e.21952$vv2.12700@[EMAIL PROTECTED]
> Hello VB experts can you help with a problem with my syntax.
> With the code below Im trying to update a field called 'Path' in a table
> 'tSchoolDetails' to 'dlgDialog.filename' (file selected in the common
> dialog), I get the following
>
> run-time error '-2147217900 (80040e14)':
> Syntax error (missing operator) in query expression
> 'E:\path\to\database\mydatabase.mdb'.
>
> any help much appreciated
> Ian
>
> 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 & dlgDialog.filename
> adoConn.ConnectionString = strConn
> adoConn.Open
> ' Define a query string
> strSQL = "UPDATE tSchoolDetails SET [Path]=" & dlgDialog.filename
> ' 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
>
>