Looks good Alan thanks. Im trying to setup a dlookup function to look at a column in a table for a value. The value could be 2,3 or 4 how would I achive this within the dlookup? Ive courrently got it set up like below:
Code:
Private Sub SelectDeptbtn_Click()
Dim sUser As String
Dim sGroup As String
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim strSQL As String
sGroup = DLookup("DepGroupID", "UserNames_tbl")
Select Case Me.DepartmentIDCombo
Case "Admin"
A = 1
Case "Mech"
A = 2
Case "Software"
A = 3
Case "Elect"
A = 4
Case "Managers"
A = 5
End Select
Select Case sGroup
Case 2
B = 2
Case 3
B = 3
Case 4
B = 4
End Select
C = A + B
Select Case C
Case 3
strSQL = "SELECT TimesheetTable.sUser, TimesheetTable.Activity, TimesheetTable.Hours, TimesheetTable.Project, TimesheetTable.[Task Date], TimesheetTable.Description, TimesheetTable.sCostCode" & _
"FROM TimesheetTable " & _
"WHERE (((TimesheetTable.sCostCode) Like 'AD-LAB'));"
End Select
End Sub
But the SelectDeptbtn_click does nothing, when I say nothing it doesnt even error.
Thanks