Needing assistance on performing a format check. Ok so what I have now is a button on my access form that exports the results into a new blank Excel file when clicked. What I am trying to accomplish now is add some code that checks if Fields 6-10 added together <> field 5 throughout the WHOLE dataset then performing conditional formatting and highlight the ones that aren't the same as yellow.
Once this is in place, Then I would like a message box to appear and however many items that are highlighted in the Excel file to appear within the list box msg. An example being there are (9) cells that are mismatched and need attention before an upload can be submitted!"
Dim dbs As DAO.Database
Dim Excel_App As Excel.Application 'Creates Blank Excel File
Dim strTable As String ' Table in access
Dim queryDelete As String 'SQL to delete records in local table
Dim strAssigned As DAO.Recordset
strTable = "Make_allUp" 'Access Table I am trying to copy
Set Excel_App = CreateObject("Excel.Application")
Set dbs = CurrentDb
Dim rs As DAO.Recordset
Set rs = dbs.OpenRecordset(strTable)
Excel_App.Visible = True
Dim wkb As Excel.Workbook
Set wkb = Excel_App.Workbooks.Add
Dim rg As Excel.Range
Dim i As Long
' Add the headings
For i = 0 To rs.Fields.Count - 1
wkb.Sheets(1).Cells(1, i + 1).Value = rs.Fields(i).Name
Next i
Set rg = wkb.Sheets(1).Cells(2, 1)
rg.CopyFromRecordset rs
' make pretty
rg.CurrentRegion.EntireColumn.AutoFit
If wkb.Sheets(1).Cells(5, 2) <> wkb.Sheets(1).Cells(6, 2) + wkb.Sheets(1).Cells(7, 2) + wkb.Sheets (1).Cells(8, 2) + wkb.Sheets(1).Cells(9, 2) + wkb.Sheets(1).Cells(10, 2) Then
Format.Cells
****Okay above is what I am having troubles with. Just needing to somehow say if the vaule in field 6 + field 7 + field 8 + field 9 + field 10 <> field 5 Then
highlight those records yellow
Set rs = Nothing
Set wkb = Nothing
Set dbs = Nothing
End Sub