Error 3464 dao

Serraset

New member
Local time
Today, 16:11
Joined
Feb 7, 2024
Messages
5
Hi,

I'm getting error 3464 while executing this code:

Sub PonerNRefsProveedores()

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim sql As String
sql = "SELECT * from nrefs"

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(sql)
DoCmd.RunSQL "update proveedores set nrefs=0"
While Not rst.EOF
DoCmd.RunSQL "update proveedores set nrefs=" & CDbl(rst!cuantos) & " where idproveedor='" & rst!Proveedor & "'"

rst.MoveNext
Wend
rst.Close


End Sub

The execution stops in: Set rst = dbs.OpenRecordset(sql)

I've checked the references, but they look ok (attached)

Does anyone know how can i solve this?

Thanks!
 

Attachments

  • MicrosoftTeams-image (2).png
    MicrosoftTeams-image (2).png
    23.1 KB · Views: 111
why not use an Update query:

set dbs = Currentdb
dbs.execute "update proveedores set nrefs=0"
dbs.execute "update proveedores As T1 Inner Join nrefs As T2 On T1.idproveedor = T2.Proveedor Set T1. nrefs=T2.cuantos;"

ActiveX data object is for ADODB object (ADODB.Recordset etc, and not DAO)
 
Last edited:
About technology

... set nrefs=" & CDbl(rst!cuantos) & "...

Why use CDbl? A recordset field is type-safe, so you shouldn't have to convert it afterwards.

If, due to your region settings, the decimal separator is not a period but a comma, this must be handled explicitly because the comma is used within SQL as a separator for field enumerations.

=> Str(rst!cuantos)
 
Well i don't really know about access and VB... and for what i've been told, this is an old access database... it was working time ago, but i think that with 365 version of Access it doesnt work properly
 
What is the error description for error 3464
 
add Reference in VBA:

ace_dao.png


or manually add Reference:

C:\Program Files\Common Files\Microsoft Shared\OFFICE16\ACEDAO.DLL
 
Code:
? AccessError(3464)
A data type error cannot be explained by a version change; data types have never been changed in 30 years, at most new ones have been added.
So if the programmatic basis remains the same, your data may have changed, or as I said, the set region.

The queries shown above are simpler and better, and they would have been 30 years ago.
 
Last edited:
have you tried the prososed query in post #2, rather than using recordset?
 
have you tried the prososed query in post #2, rather than using recordset?
Do i need to change this:

Set rst = dbs.OpenRecordset(sql)
DoCmd.RunSQL "update proveedores set nrefs=0"
While Not rst.EOF
DoCmd.RunSQL "update proveedores set nrefs=" & CDbl(rst!cuantos) & " where idproveedor='" & rst!Proveedor & "'"

for this?:

set dbs = Currentdb
dbs.execute "update proveedores set nrefs=0"
dbs.execute "update proveedores As T1 Inner Join nrefs As T2 On T1.idproveedor = T2.Proveedor Set T1. nrefs=T2.cuantos;"
 

Users who are viewing this thread

Back
Top Bottom