during the access time data from the database cani lock the some column headers

lock the row headers and there data except leaving from attributes to line status data rows


example:

BMS_ID level(1/2/3) item num Original Mfg Name Original Mfg Part # Original_Supplier Name Original_Supplier Part # Original_Description Mfg Name MFR Part No SUPPLIER_NAME SUPPLIER_PART NO Noun MODIFIER Noun Modifier ATTRIBUTE_NAME1 ATTRIBUTE_VALUE1 ATTRIBUTE_NAME2 ATTRIBUTE_VALUE2 ATTRIBUTE_NAME3 ATTRIBUTE_VALUE3 ATTRIBUTE_NAME4 ATTRIBUTE_VALUE4 ATTRIBUTE_NAME5 ATTRIBUTE_VALUE5 ATTRIBUTE_NAME6 ATTRIBUTE_VALUE6 ATTRIBUTE_NAME7 ATTRIBUTE_VALUE7 ATTRIBUTE_NAME8 ATTRIBUTE_VALUE8 ATTRIBUTE_NAME9 ATTRIBUTE_VALUE9 ATTRIBUTE_NAME10 ATTRIBUTE_VALUE10 ATTRIBUTE_NAME11 ATTRIBUTE_VALUE11 ATTRIBUTE_NAME12 ATTRIBUTE_VALUE12 ATTRIBUTE_NAME13 ATTRIBUTE_VALUE13 ADDITIONAL_INFORMATION Customer_Specific_Information ENHANCED_INFORMATION SERIAL NO MODEL NO DWG.NO ALTERNATE_MFR_NAME 1 ALTERNATE_MFR_PARTNO 1 ALTERNATE_MFR_NAME 2 ALTERNATE_MFR_PARTNO 2 ALTERNATE SUPPLIER NAME 1 ALTERNATE SUPPLIER PART NO 1 ALTERNATE SUPPLIER NAME 2 ALTERNATE SUPPLIER PART NO 2 URL1 URL2 URL3 FQR_User_Code User_Comments QC_Comments Line_status


[CODE]Dim cnt As ADODB.Connection
Dim rst1 As ADODB.Recordset, rst2 As ADODB.Recordset
Dim stDB As String, stSQL1 As String, stSQL2 As String
Dim strConn As String
Dim wbBook As Workbook
Dim Sheet1 As Worksheet
Dim i
Dim Target As Range

Dim column As Integer
Dim lnField As Long, lnCount As Long
Dim dataStr As String
'Instantiate the ADO-objects.
Set cnt = New ADODB.Connection
Set rst1 = New ADODB.Recordset
Set rst2 = New ADODB.Recordset

Set wbBook = ThisWorkbook
Set Sheet1 = wbBook.Worksheets(1)

'Path to the database.
stDB = "mysql32"

'Create the connectionstring.
strConn = "Driver=MySQL ODBC 5.2 Unicode Driver;" _
& "Data Source=" & stDB & ";"

'The 1st raw SQL-statement to be executed.
'stSQL1 = "SELECT * FROM tblbatch_headers where idBatch " & batchID & "order by col_seq asc"

'The 2nd raw SQL-statement to be executed.
stSQL2 = "SELECT * FROM " & BMS.TextBox1 & " where FQR_User_Code='" & Environ("username") & _
"' and line_status in('QP')" '
'Clear the worksheet.
Sheet1.Range("A1:FA1").CurrentRegion.Clear

With cnt
.Open (strConn) 'Open the connection.
.CursorLocation = adUseClient 'Necessary to disconnect the recordset.
End With

With rst1
' .Open stSQL1, cnt 'Create the recordset.
Set .ActiveConnection = Nothing 'Disconnect the recordset.
End With

With rst2
.Open stSQL2, cnt 'Create the recordset.
Set .ActiveConnection = Nothing 'Disconnect the recordset.
End With



With Sheet1
' .Cells(2, 1).CopyFromRecordset rst1 'Copy the 1st recordset.
For i = 1 To rst2.Fields.Count
.Cells(2, i).Value = rst2.Fields(i - 1).Name
Next i
.Cells(3, 1).CopyFromRecordset rst2 'Copy the 2nd recordset.
End With

'If target.column < 16 Then
'Application.EnableEvents = False
' Application.Undo
'Application.EnableEvents = True

' MsgBox "You cannot do that!"
'End If
' End With
rst2.Close
Set rst2 = Nothing
cnt.Close
Set cnt = Nothing
'Release objects from the memory.
' rst1.Close
' Set rst1 = Nothing


Unload Me[CODE]