We help IT Professionals succeed at work.
Get Started

Check box question

urjudo asked
Last Modified: 2015-02-25
Hi Experts,
I have a form in Access 2010 database, the form is call "frmFileRequested", I put a unbound check box on the form for user who needs to request a file.  They check the check box, it automatic file the name of the requestor which who is sign in to the computer and date.  but one of the problem is once a user requested the file (check the check box), when user exit the database, the check box is unchecked, it should be still checked to prevent next user to over write the requested the same record, I also want to do is after a user check the checked box to requested a file, once the user exit the database, the checked box for that record still check and lock so that  the next user can not request the same file is someone already requested .  Here are the code:

I have "Check29" which is a checkbox,  also a command32 on the top of the check29

Option Compare Database
Option Explicit
Dim colCheckBox      As New Collection
Public Function IsChecked(vID As Variant) As Boolean
   Dim lngID As Long
   IsChecked = False
   On Error GoTo exit1
   lngID = colCheckBox(CStr(vID))
   If lngID <> 0 Then
      IsChecked = True
   End If
End Function

Private Sub Check29_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
      KeyCode = 0
      Call Command32_Click
   End If
End Sub

Private Sub Command32_Click()

   If IsChecked(Me.ClientNo) = False Then
      colCheckBox.Add CLng(Me.ClientNo), CStr(Me.ClientNo)
      RequestedDate = Date
      Requestor = Environ("USERName")
       colCheckBox.Remove (CStr(Me.ClientNo))
      RequestedDate = Null
      Requestor = Null
      Exit Sub
   End If
End Sub

Watch Question
Retired IT Professional
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE