Here is the code im working with. Need to figure out how to add code that will look for the "Name of Panel" and filter out the Analog inputs.
VBA Code:
Option Explicit
Sub AnalogInput_DB()
'Path
Dim strPath As String
'Provider
Dim strProv As String
'Connection String
Dim strCn As String
'Connection
Dim Cn As New Connection
'RecordSet for AI
Dim rsQry_AI As New Recordset
'SQL Query for AI
Dim strQry_AI As String
'Establish connection to Project DB. Looks at the filepath specified in cell B1 of Project_DB Sheet
strPath = ActiveWorkbook.Sheets("PAGE").Range("B1").Text
strProv = "Microsoft.ACE.OLEDB.12.0;"
strCn = "Provider=" & strProv & "Data Source=" & _
strPath
'Connection Open
Cn.Open strCn
intID = TOC.[A27]
'SQL Query to import Digital Input Tags
strQry_AI = "SELECT Instruments.PLCPanel, Instruments.Address FROM Instruments WHERE (((Instruments.AnalogInput)=True)) ORDER BY Instruments.PLCPanel;"
rsQry_AI.Open strQry_AI, Cn
'Puts Data into the Device Column of the Digital Device Sheet
ActiveWorkbook.Sheets("AnalogInput").Range("A17").CopyFromRecordset rsQry_AI
Cn.Close
End Sub