How can I prevent additional rows being added

I have a child table that captures check in and check out, but currently it allows someone to be checked in again even if they haven’t checked out. Is there a way to prevent this?

You’ll need to edit the behavior of that table’s Add action.

An expression like:

ISNOTBLANK(
     MAXROW("MDP Check In and Out Log", "CheckOutDateTime", USERNAME()=[MDP Name])
)

This is assuming that [MDP Name] is captured using USERNAME() in the first place. Otherwise, you’ll have to replace that section with some other check to compare that name. Once you have it working, that should allow multiple users to check in, but force all of them to check out before being able to check back in.

I tried this: ISNOTBLANK(MAXROW(“dbo.tblMDPCheckInCheckOut”, “CheckOutDateTime”, [RegID] = [RegID]))

but it doesn’t prevent the add/new check in.

dbo.tblMDPCheckInCheckOut has the RegID column that is a ref column to the dbo.tblEvacuationRecord table which has the recent row expression - not sure if that matters.

the check in/out is happening in the MDPcheckincheckout table. Do I need to included the Related dbo.tbleEvacuationRecord somewhere in the expression?

I was able to “hide” the action button for check in but can not seem to get anything to work for the “new” action on the child table.

image

If I could get “new” either not to show or have a confirmation message to prevent accidental duplicate check ins that would be great.

image

Create a read-only slice of dbo.tblMDPCheckInCheckOut and use that for display purposes. Being read-only, adds, edits, and deletes will all be blocked. Your action, though, will work against the table, so won’t be affected by the slice’s read-only restrictions.

2 Likes