question

vanhunghuynh-0785 avatar image
0 Votes"
vanhunghuynh-0785 asked KarlDonaubauer answered

Run-time-error 3020

I try to use code following code to update the table but received error. I don't know how to fix this error. Anyone know please help me.
125283-error-3020.png


Private Sub DungTy_AfterUpdate()
Dim T05b As Recordset
Set T05b = CurrentDb.OpenRecordset("T05b Chi tiet LABDIP", dbOpenTable)
T05b.Index = "Color_code"
T05b.Seek "=", Color_Code
If Not T05b.NoMatch Then
Do
If T05b.EOF Then Exit Do
If T05b!Loai_ND Like "GL" Then
T05b!SlgSDung = T05b!Nong_do DungTy / 1000
TTien = Dgia
SlgSDung
End If
T05b.MoveNext
Loop
End If
T05b.Close

Call TinhGiaNhuom
End Sub

office-access-dev
error-3020.png (19.8 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you develop UWP app ?

0 Votes 0 ·

no, microsoft access

0 Votes 0 ·

This topic is not related with UWP, but more related with office-access-dev I have updated it.

0 Votes 0 ·

1 Answer

KarlDonaubauer avatar image
0 Votes"
KarlDonaubauer answered

Hi,

To update a field in a DAO.Recordset you have to use the methods Edit and Update. So, instead of just

T05b!SlgSDung = T05b!Nong_do * DungTy / 1000

try

T05b.Edit
T05b!SlgSDung = T05b!Nong_do * DungTy / 1000
T05b.Update

Servus
Karl


http://AccessDevCon.com
https://www.donkarl.com

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.