Reset checkbox for a single record (1 Viewer)

Barbshop

New member
Local time
Today, 01:47
Joined
Aug 15, 2018
Messages
7
Hi, I'm not a programmer, but have developed an access database to be used by church volunteers.


One table and corresponding form is used to enter basic information about a family coming for assistance at the church. The first time the family visits the church there is a checkbox called "new family" that is checked to indicate this is their first visit. If the family returns for a subsequent visit, the checkbox needs to be unchecked as they are no longer a "new" family. Currently the data entry person is asked to do this manually. They often forget. Is their a simple way to have the checkbox revert to unchecked when the record is opened a second time?


Sorry if this seems a bit vague.


Thanks for any advice.


Barbshop
 

Minty

AWF VIP
Local time
Today, 09:47
Joined
Jul 26, 2013
Messages
10,366
Do you record a last visit date in your record?
That might be a better route than a check box, as it gives you a data point that could drive a notification flag on the screen, and also encourage updating of existing records.

Better still, you could add a visit history as a sub table for that family, then you would have useful data to analyse. This could be added to automatically every time the visit form was updated?
 

Barbshop

New member
Local time
Today, 01:47
Joined
Aug 15, 2018
Messages
7
Thanks Minty. Let me explain. This is a food pantry system, and the pantry produces a report after each food pantry day. That report needs to track the number of "new" families who visited that day. The field called "new family" is on the master intake record form. This form has all the information about the customer and also contains fields tracking their specific visit dates (called "service dates").



When the customer returns for a subsequent visit, they should not be counted as a "new" family. Therefore the need to remove the check mark in that field. Currently I have a message box that pops up when that filed has focus that reminds them to uncheck it. I was hoping to automate this somehow.


I've attached an image of the Intake Form

I'm probably over complicating this. Thanks for bearing with me.
 

Attachments

  • FPS_Intake_Form.png
    FPS_Intake_Form.png
    57.2 KB · Views: 52
Last edited:

Minty

AWF VIP
Local time
Today, 09:47
Joined
Jul 26, 2013
Messages
10,366
Okay - In that case you can simply count the service dates and that will tell you that they are a new or existing family. In fact the need for the check box sort of disappears.

In the current event of the form you can use something like;


Code:
If DCount("*","YourServiceDateTable","CustomerID = " & Me.CustomerID) >1 Then
      Me.ChkNewCustomer = False
End iF

You'll need to use the relevant fields and control names, but hopefully that will get you started.
 

Barbshop

New member
Local time
Today, 01:47
Joined
Aug 15, 2018
Messages
7
Thanks much Minty, that sounds like it should work. Let me give it a try.
I love clever people who are smarter than I am (there are a lot of them.)


Minty, I apologize, but I'm much better at singing than I am at coding. I can't seem to make your suggestion work. I think I'm not putting it in correctly. Below is what is already in the On Current Event for this form:


Option Compare Database

Private Sub cmdPrint_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Intake_ID] = " & Me.[Intake_ID]
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub


Private Sub Command122_Click()

End Sub

Private Sub Form_Current()
Me.Combo123.Value = Null
End Sub

Private Sub Form_Load()

End Sub


Private Sub Form_Open(Cancel As Integer)

End Sub


I'm not sure where to insert the additional code. Thank you for being patient with me.
 
Last edited:

Users who are viewing this thread

Top Bottom