


Cell(rsIt.AbsolutePosition + 2, 4).Range.InsertAfter strPr StrPr = strPr & " " & rsPr.Fields(4).Value If Not (rsPr.BOF And rsPr.EOF) = True Then Set rsPr = dbCur.OpenRecordset(strSQL, dbOpenDynaset) StrSQL = "Select Distinct Precaution From IHR where item is" 'select distinct precaution based on item Cell(rsIt.AbsolutePosition + 2, 3).Range.InsertAfter strHz StrHc = strHz & " " & rsHz.Fields(2).Value If Not (rsHz.BOF And rsHz.EOF) = True Then Set rsHz = dbCur.OpenRecordset(strSQL, dbOpenDynaset) StrSQL = "Select Distinct Hazard From IHR where item is" Cell(rsIt.AbsolutePosition + 2, 2).Range.InsertAfter strHc StrHc = strHc & " " & rsHc.Fields(2).Value If Not (rsHc.BOF And rsHc.EOF) = True Then Set rsHc = dbCur.OpenRecordset(strSQL, dbOpenDynaset) StrSQL = "Select Distinct Hazcard From IHR where item is"

Cell(rsIt.AbsolutePosition + 2, 1).Range.InsertAfter rsIt.Fields(1).Value If Not (rsIt.BOF And rsIt.EOF) = True Then Set rsIt = dbCur.OpenRecordset(strSQL, dbOpenDynaset) StrSQL = "Select Distinct Item From IHR where filename is" Cell(1, 4).Range.InsertAfter "Precaution" Set rngCcCur = docCur.ContentControls(6).RangeĪ Range:=rngCcCur, NumRows:=1, NumColumns:=4 Set docCur = (FileName:=strDocPath & strDocName, ReadOnly:=False, Visible:=False) Set dlgCur = Application.FileDialog(msoFileDialogFolderPicker) The code is also kind of clunky with the multiple recordsets, if anyone has any better ideas would love to here them. Sorry for incredibly long code block - I felt it was important to show everything so that it was easier to find the problem. I need to be able to edit the document (that is the whole point of the code). Word then shows a file locked for editing/ open read only prompt. The following code runs as far as the marked line.
