I am using Access 2003 for a user gui and the original data is pulled from Oracle.

I need to lower the processing time and would like to write a pass through query to retreive the information via VBA/VB code behind an access form

I have queried this forum an I have only located a version using ADO but it really didn't focus on the query itself or maybe it does and I just do not undersstand all it says.

does anyone have any suggestions or references for me to look at?

This is what I have located currently:
VB Code:
  1. Public Sub PassThroughADO(ByVal strQdfName As String, _
  2.                                       ByVal strSQL As String, _
  3.                                       Optional varConnect As Variant, _
  4.                                       Optional fRetRecords As Boolean = True)
  5.  
  6.     '   strQdfName is the name of the query
  7.     '   strSQL  is the new SQL string, if you need to update the original query
  8.     '   varConnect is the optional connection string, probably need this
  9.     '   fRetRecords Optional returns records defaults to True(or yes, what you want)
  10.  
  11.     Dim cat As ADOX.Catalog
  12.     Dim cmd As ADODB.Command
  13.  
  14.     ' Open the catalog
  15.     Set cat = New ADOX.Catalog
  16.     Set cat.ActiveConnection = cn
  17.  
  18.        ' Get the command to fire
  19.        'here the string parameter of the query name is passed
  20.        
  21.        Set cmd = cat.Procedures(strQdfName).Command
  22.      
  23.       ' set pass-through properties
  24.      
  25.       cmd.Properties("Jet OLEDB:ODBC Pass-Through Statement") = True
  26.      
  27.       ' Update the SQL, or what to select from the query
  28.        cmd.CommandText = strSQL
  29.  
  30.           ' Update the Connection string, make sure we successfully get through
  31.           'your SQL Server
  32.          If Not IsMissing(varConnect) Then
  33.             cmd.Properties _
  34.             ( "Jet OLEDB:Pass Through Query Connect String") = CStr(varConnect)
  35.          End If
  36.    
  37.           ' Update the ReturnsRecords property
  38.           ' to return or NOT return records
  39.  
  40.         cmd.Properties( _
  41.        "Jet OLEDB:Pass Through Query Bulk-Op") = Not fRetRecords 'or fRetRecords
  42.  
  43.      ' Save the changes you have fired
  44.  
  45.       Set cat.Procedures(strQdfName).Command = cmd
  46.      
  47.      'Clean up variables
  48.      Set cmd = Nothing
  49.      Set cat = Nothing