Results 1 to 2 of 2
  1. #1
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017

    How to set If statement?



    I have a question based on login for employee to open the next form based on their IDs.

    I would like to set Employee IDs 1 To 10 to openForm in normal mode and the rest to openForm in read-only mode.

    Any suggestions will be helpful.

    Option Compare DatabaseOption Explicit
    Private Sub btnLogin_Click()
        'Assigning Variables
        Dim strcboPass As String
        Dim strPassword As String
        Dim strSection As String
        Dim intID       As Integer
        'Setting Variables based on condition in cbobox
        strcboPass = Me.cboUsername.Column(1)
        strPassword = Nz(Me.txtPassword, " ")
        strSection = Me.cboUsername.Column(2)
        intID = Me.cboUsername.ColumnCount(0)
            'Evaluate Expression whether the user is true
            If strPassword = strcboPass Then
            If intID 1,2,3,4,5,6,7,8,9,10 then
                'Grouping them in their respective sections
                Select Case strSection
                Case "ELE"
                DoCmd.OpenForm "frmMaster", acNormal, , , , acWindowNormal
                DoCmd.Close acForm, "frmLogin"
                Case "CCTV"
                DoCmd.OpenForm "frmMaster", acNormal, , , , acWindowNormal
                End Select
                MsgBox "Login UnSuccessful!"
                Me.txtPassword = Null
                Exit Sub
            End If
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    If intID > 0 And IntID < 11 Then
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 04-29-2015, 01:38 PM
  2. IIf/and statement
    By BringTheR41n in forum Access
    Replies: 10
    Last Post: 07-08-2014, 02:03 PM
  3. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  4. Iif statement help
    By Firefighter22 in forum Queries
    Replies: 7
    Last Post: 09-30-2011, 10:59 AM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums