31/01/2025, 21:26
berduş
biraz değişiklik yaptım, yeni bir tablo ve sorgu ekledim, aşağıdaki kod belirttiğiniz özelliklere sahi ürün IDlerini tabloya ekliyor
Private Sub AK_Kategori_AfterUpdate()
If Me.AK_Kategori.Value <> "" Then xKriter = " where kategori='" & Me.AK_Kategori.Value & "'"
Set db = CurrentDb()
Set ADO_RS = db.OpenRecordset(Name:="select [id] from tbl_urun" & xKriter, Type:=RecordsetTypeEnum.dbOpenDynaset)
With ADO_RS 'loop
db.Execute "delete * from Capraz_Tbl"
If Not .BOF And Not .EOF Then
.MoveFirst
x = -1
y = 0
While (Not .EOF)
x = (x + 1) Mod 3
If x = 0 Then
y = y + 1
'
strSQL = "INSERT INTO Capraz_Tbl ([ID],[Resim0]) VALUES ( " & y & ", " & .Fields(0) & ");"
Else
strSQL = "update Capraz_Tbl set [Resim" & x & "] = " & .Fields(0) & " where [ID]=" & y
End If
db.Execute strSQL
.MoveNext
Wend
End If
End With
Me.Requery
End Sub