test123

Public Function fCountSQL(strSQL0 As String) As Long  
 Dim strSubName As String  
 Dim strModuleName As String  
   
 strSubName = "fCountSQL"  
 strModuleName = "Module - " & "basCopyListToData"  
   
 On Error GoTo Error_Handler  
   
 'Needs reference to Microsoft ActiveX Data Objects 6.1 or the eqivilant for your version of MS Access  
   
 Dim rs As ADODB.Recordset  
 Set rs = New ADODB.Recordset  
 rs.ActiveConnection = CurrentProject.Connection  
 rs.CursorType = adOpenKeyset  
 rs.Open strSQL0  
   
       fCountSQL = rs.RecordCount  
       rs.Close  
 Exit_ErrorHandler:  
     
   Exit Function  
   
 Error_Handler:  
     Select Case Err.Number  
       Case 1 'When Required, Replace Place Holder (1) with an Error Number  
         MsgBox "Error produced by Place Holder please check your code ! Error Number >>> " _  
         & Err.Number & " Error Desc >> " & Err.Description, , conAppName & " fCountSQL"  
       Case Else  
         MsgBox "Error From --- " & strModuleName & ", " & strSubName & " --- Error Number >>> " & Err.Number _  
         & " <<< Error Description >> " & Err.Description, , conAppName  
     End Select  
   Resume Exit_ErrorHandler  
   
 End Function   'fCountSQL
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn