MohamedHamada
2024-05-26T15:14:29Z
How can i compare column(6) values in excel userform igrid with column values in access database and if any value in igrid different with column of access data get msgbox “ items different with database “
Best Regards,Mohamed
Igor/10Tec
2024-05-27T14:09:36Z
You can always retrieve iGrid cell values with the iGrid.CellValue property and compare them with the data from the database. As for the database part, it is not a question about iGrid. This part depends on the technique your are using to access database rows (reading table records directly or retrieving SQL SELECT recordsets via DAO/ADO, etc.)
MohamedHamada
2024-05-30T07:19:08Z
Dim i As Integer
Call Connect
qry = "SELECT * FROM Items"
rs.Open qry, cn, adOpenKeyset, adLockOptimistic
For i = 1 To iGrid.rowCount
If iGrid.Cellvalue(i, 6).value <> rs.fields("ÑÞã ÇáÕäÝ").value Then
MsgBox (" ÊæÌÏ Ýì åÐÇ ÇáÚÑÖ ÇÕäÇÝ áíÓ áåÇ ÈØÇÞÇÊ - áÇÈÏ ãä ÊÚÑíÝåÇ ÞÈá ÇäÔÇÁ ÇáÝÇÊæÑÉ"), vbInformation
Else
MsgBox (" íÌÈ ÊÍÏíÏ ÑãÒ ÊÑÞíã ÃæÇãÑ ÇáÚãá ááãÓÊÎÏã ÇáÍÇáì ááÈÑäÇãÌ"), vbCritical
MsgBox (" ÍÕá ÎØÃ Ýì ÊÍÏíÏ ÑÞã ÃãÑ ÇáÚãá ÇáÌÏíÏ"), vbCritical
Exit For
End If
rs.MoveNext
Next i

here is my code and its compare result in first cell in the column not all cells in it
Igor/10Tec
2024-05-30T08:09:43Z
See just 1 problem with this statement:

If iGrid.Cellvalue(i, 6).value <> rs.fields("ÑÞã ÇáÕäÝ").value Then

It should be

If iGrid.CellValue(i, 6) <> rs.fields("ÑÞã ÇáÕäÝ").value Then