conditions to show data

benc

Registered User.
Local time
Today, 04:51
Joined
Dec 31, 2001
Messages
57
I have created an unbound form and put in place two unbound toggle buttons labeled current & not current if a user selects either toggle then the relevant data is shown. So if current toggle is selected and the user clicks on the button to show the data it will check the table to see if the field (iscurrent) is true and then shows those records and vice versa for the not current. however i cant seem to get it to bring up the data. my code is as follows:

Private Sub show_agents_Click()

'the user selects the "current" toggle button if they wish to see all current agents
'If the toggle is selected then show the records where the field "iscurrent" is true

If Me.current = True And iscurrent = True Then

Const Showrecords = "SELECT Employees.FirstName, Employees.LastName, Employees.Title, Employees.BirthDate FROM Employees"

'the user selects the "notcurrent" toggle button if they wish to see all noncurrent agents
'If the toggle is selected then show the records where the field "iscurrent" is false

ElseIf Me.notcurrent = True And iscurrent = False Then

Const Showrecords = "SELECT Employees.FirstName, Employees.LastName, Employees.Title, Employees.BirthDate FROM Employees"

'the user has not selected a toggle button if they wish to see all agents
'then all agents will be seen if button is clicked

ElseIf Me.current = False And Me.notcurrent = False Then

Const Showrecords = "SELECT Employees.FirstName, Employees.LastName, Employees.Title, Employees.BirthDate FROM Employees"

End If
End If
End If

iscurrent = DLookup("iscurrent", "[Agent]")

End Sub
Can anyone help to point out where i am going wrong. Thanks
 
I've got a combo box that has three options: Active, Inactive, or All. Try something akin to this:
Code:
Private Sub SelActiveInactive_Change()
    Select Case SelActiveInactive
        Case "Active"
            Me.RecordSource = "SELECT * FROM queryExistingContacts WHERE ActiveStatus = -1"
        Case "Inactive"
            Me.RecordSource = "SELECT * FROM queryExistingContacts WHERE ActiveStatus = 0"
        Case "All"
            Me.RecordSource = "queryExistingContacts"
    End Select
End Sub
 

Users who are viewing this thread

Back
Top Bottom