DCount Problem.. in form load

bitsbb01

Registered User.
Local time
Today, 17:23
Joined
Apr 2, 2013
Messages
34
Hello Everyone,
Hope everyone is having a better day than me.. as i just cannot get this to work...

This is the problem, I have a table for tickets, and want a popup to show for the current user..

if i take out the & Me.Text42) it shows theres 90 Active tickets, but thats for all the users, i want it to shows just the current user, and as the tickets are stored in the tables under the full name, i have already got it to convert the username to the current full name, which is then Me.Text42.

so is there a specific way for the DCount to be reading it, as the ID is the ticket number, the RWSlipsTable is the tickets table, Active shows for current Open Tickets, and of course Text42 is the textbox with the Full name of the current users.

Oh and [Caseworker] is the field in the RWSipsTable for Me.Text42 (Current users full name)

Code:
Option Compare Database
Private Sub Form_Load()
 
'On Load of the Main menu check tickets table for any uncompleted tickets
Me.List0 = Environ("username")
Me.Text42 =[List0].[Column](1)
 
Dim intStore As Integer
'Count of uncomplete jobs
intStore = DCount("[ID]", "[RWSlipsTable]", "[Active] =True" & Me.Text42)
 
'If count of uncomplete jobs is 0 display Mainmenu
'Else display message box detailing amount of tickets for current user
'and give the user the option as to whether to view these or not.
    If intStore = True Then
            Exit Sub
                Else
                    If MsgBox("There are " & intStore & " uncompleted Tickets" & _
                    vbCrLf & vbCrLf & "Would you like to see these now?", _
                    vbYesNo, "You Have Uncomplete Tickets...") = vbYes Then
                    DoCmd.Minimize
                    DoCmd.OpenForm "RWslipQuery3-poppup", acNormal
                Else
            Exit Sub
        End If
    End If
End Sub


Sorry if this doesnt make much sence, been working with this for last 14 hours :banghead:, getting the menu redone, etc and it pulling the correct information, got everything working except for the current user...
 
Last edited:
You don't have the field name for the second argument, plus if it's text you need delimiters. Try

intStore = DCount("[ID]", "[RWSlipsTable]", "[Active] =True AND Caseworker = '" & Me.Text42 & "'")
 
Lol.. i wont say how many time i've been trying things like that
and even did
intStore = DCount("[ID]", "[RWSlipsTable]", "[Active] =True AND Caseworker = " & Me.Text42)
and still didnt work.. always seem to forget the simplist things like '
lol

Thank you for making my night a lot better..
 

Users who are viewing this thread

Back
Top Bottom