Check box question

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
   
exit1:
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")
   Else
       colCheckBox.Remove (CStr(Me.ClientNo))
      RequestedDate = Null
      Requestor = Null
      Exit Sub
   End If
   
   Me.Check29.Requery
   Me.Refresh
   
End Sub


Thanks,
urjudoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
hnasrCommented:
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.
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
urjudoAuthor Commented:
Thank you for your advise.  I added a field for the check box, now it works.
0
 
hnasrCommented:
Welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.