Executing Query (On Access Table) From Visual Basic using ADO Link
Posted on 2003-03-13
I've connected to an Access Database using ADO as follows:
Public Const varConnectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=S:\Database.mdb;Persist Security Info=False"
Dim Db As New ADODB.Connection
Now, I want to do an update on a table. However, the update query has a function that I have created:
Db.Execute "Update [Temp] Set [Field1] = LeftZeros([Field1],5)"
This works fine in Access. When I try it in Visual Basic, it tells me "Undefined Function 'Leftzeros'". But the function is there. If I test the function from the Debug window, it works fine. How can I fix this?