Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Record Count from Query
Message
From
22/06/2012 08:26:22
 
 
To
All
General information
Forum:
Visual Basic
Category:
Access
Title:
Retrieving Record Count from Query
Miscellaneous
Thread ID:
01546611
Message ID:
01546611
Views:
57
I know I am all over the map on this one so please forgive me...I would like to return the record count of a Query. Sounds simple enough but I'm getting error etc.
Public Function IsValidUser()
    Dim t_RecSet_user As Recordset, db As DAO.Database, qdf As DAO.Recordset, No_Recs As Integer
    Dim QueryName As String
    
    QueryName = "User_Access"
    
    Set db = CurrentDb
    'Set qdf = db.OpenRecordset(QueryName)
    'qdf.MoveLast
    
    DoCmd.OpenQuery "user_access"
    
    'No_Recs = DCount("*", "User_Access")
    
    'No_Recs = qdf.RecordCount
    
    Set qdf = Nothing
    Set db = Nothing
       
   ' Set t_RecSet_user = CurrentDb.OpenRecordset("select * from case_mgr where case_mgr.[casemgr_userid]='" & t_UserId & "';")
        
   
    If No_Recs > 0 Then
        't_RecSet_user.MoveLast
        IsValidUser = "Yes"
        MsgBox "you are validated to access system" & " " & UCase(t_UserId)
    Else
        IsValidUser = "No"
        MsgBox "you are not validated to access system" & " " & UCase(t_UserId)
    End If
        
    'Set t_RecSet_user = Nothing
   
(returnusername)
End Function
Thanks in Advance.

J. Turner
Next
Reply
Map
View

Click here to load this message in the networking platform