Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Record Count from Query
Message
 
 
To
22/06/2012 08:26:22
General information
Forum:
Visual Basic
Category:
Access
Miscellaneous
Thread ID:
01546611
Message ID:
01546702
Views:
36
>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
>
When you say you're "getting error etc.", what error are you getting and on what line?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform