Just a small fix, there was a translation bug in the previous post Try the following VB code and adapt it . Dim db As Database, db_dcs As Database Dim historian As String, DCS As String Private Sub Form_Load() 'Get the current DCS instance and Historian instance and make a connection with it DCS = GetSetting(App.Title, "Settings", "DCS", "AW7001") historian = GetSetting(App.Title, "Settings", "Historian", "hist01") ConnectStr = "DSN=AIM AT Historian Database;AP=" & DCS & ";DB=sample" ConnectStr = "odbc;" & ConnectStr 'Open the server connection Set db_dcs = OpenDatabase("", 0, 0, ConnectStr) End Sub Private Sub Form_unload() ' At the end, close connection db_dcs.close set db_dcs = Nothing End Sub Sub Get_Messages() Dim rs_Data as recordset ' needs a reference to DAO 3.6 Dim Initial_Time as string, sSQL as string Dim Initial_Date as Date Initial_Date = date -1 ' just for show, the real app makes use ot this variable Initial_Time = "{ts '" & Format(Initial_Date, "yyyy-mm-dd hh:nn:ss") & "'}" sSQL = "select date_time, compound_name,block_name,block_desc, alarmtype_msg, priority,in_out_txt " & _ "from event/" & historian & ".iaalarm:alarmmesg " & _ "where date_time > " & Initial_Time & " order by date_time ASC" Set rs_data = db_dcs.OpenRecordset(sSQL, dbOpenSnapshot, dbForwardOnly + dbSQLPassThrough) If rs_data.EOF Then msgbox "No New Alarms since " & Initial_Time while not rs_Data.Eof ' Do whatever you want with rs_Data!Date_Time , rs_Data!compound_name, rs_Data!block_name , etc rs_Data.MoveNext doEvents ' Let windows breathe wend 'Used it, now close it and destroy it rs_Data.close set rs_data = nothing 'Clean up Memory sSQL = vbNullString Initial_Time = vbNullString sSQL = vbNullString End Sub -----Mensagem original----- De: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] Em nome de William C Ricker Enviada: segunda-feira, 27 de Agosto de 2012 04:58 Para: foxboro@xxxxxxxxxxxxx Assunto: [foxboro] AIM* 3.3 Programmed access to Messages List; Is there one among us who has managed to access messages collected by the AIM* historian using the AIM*API calls ft_FdbMsgQuery ? We are able to retrieve other information from the historian, but not messages. We are aware that the 3.3 version of AIM* ships without the necessary files to make OLE-DB work, so we can't make that method work. After various failed attempts at programmed access we wonder if there is some mismatch between document and code, or if there might be some deficiency in this function as distributed in the V 3.3 release. If someone else has made it work and perhaps even feels inclined to forward an example we would be grateful. Thanks, William C Ricker FeedForward, Inc. _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave ________________________________ Aviso: Este e-mail e quaisquer ficheiros inform?ticos com ele transmitidos s?o confidenciais e podem conter informa??o legalmente privilegiada. Caso tenha recebido este e-mail indevidamente ou julgue n?o ser o destinat?rio do mesmo, queira informar de imediato o remetente e proceder ? elimina??o desta mensagem. ? estritamente proibido o uso, reencaminhamento ou reprodu??o n?o autorizada desta mensagem e de quaisquer ficheiros nela contidos. Qualquer opini?o expressa na presente mensagem ? imput?vel somente ? pessoa que a enviou, a n?o ser que o contr?rio resulte expressamente do seu texto. Como o correio electr?nico pode ser afectado por dificuldades t?cnicas ou operacionais, n?o se garante a sua recep??o de forma adequada e atempada. A mensagem foi filtrada por um detector de v?rus pelo que o remetente n?o se responsabiliza por danos provocados por terceiros no sistema inform?tico do destinat?rio. Warning: This e-mail and any files transmitted are confidential and may well also be legally privileged. If you are not the intended recipient or have received it in error or if you believe that you received a misaddressed e-mail transmission, please notify us immediately by reply e-mail and then delete this message from your system. Any unauthorized use, copying, disclosure or distribution of contents of this e-mail is strictly prohibited and may be unlawful. Unless otherwise stated, all views and opinion herein contained are solely the expression of the sender. As e-mail can be subject to operational or technical difficulties, the quality of reception may be affected and may be subjected to time delays. A virus checker sweeps outgoing e-mail. Therefore the sender doesn't accept any responsibility or liability whatsoever for any adverse effects on your systems or data arising from intercepted, corrupted or virus infected e-mail. __CUFdisclaimer2011__ _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave