We help IT Professionals succeed at work.

Check box question

urjudo asked
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
The problem is: Unbound Checkbox is unchecked when database restarts, this is normal.

To control the checkbox you may need to save its status in a table, and read that table when restarting the application.


Thank you for your advise.  I added a field for the check box, now it works.
Hamed NasrRetired IT Professional