primary check box for multiple records, per candidate 1 checkbox

misscrf

Registered User.
Local time
Today, 01:59
Joined
Nov 1, 2004
Messages
158
Here is the issue that I need to resolve here.

On my candidate form, I have subforms for addresses and phones. A candidate can have more than one type of each. What I have here is a checkbox for the primary address on the form, in the table. I need to lock down some code that will only allow one address for a candidate be checked as the primary candidate.

If anyone can help, I would really appreciate it. I would like to be able to roll out this db by the end of the month or sooner!

Thanks so much for all the help!
 
ok, I will go into more depth.

I have been working on just informing the user with a label that would be hidden until more than one address is checked as primary for one candidate.

It is being recommended, however, that I lock down the control, so that the user can't just walk away.

here is the exact dilema.

I want the first address inputed for a candidate, to be marked as primary. Then for any subsequent addresses added, I need to figure how to tell the user to choose a primary, or just wait to see if they try to change it. Or I could just let them "change" it. This would have no message or error to it.

It would be code that would say if there is any checked for this candidate, then uncheck and check this one. does that make sense? Can someone help me with the code to do this?

Thanks
 
Two possible answers (as usual)

I assume that you have a check box by each address or phone number that indicates whether or not this address is the primary. There are two ways to do this, instead of having one check box for each, have a drop down box that gives the number of the address that is the primary.

or on afterupdate event of the check box, have a check sequence that requires that the user to clear the old primary check box first so that no change can be made until the old check box is cleared. That forces the thought process to verify that unchecking the old is really changing the primary address.

sg
 
I had thought about that second method, but I kept coming back to one issue. I don't want a lot of things stopping users as they work. These users know what they want to enter. I thought of this. What if the checkbox would check afterupdate if it is the first address, and if it is the second or next address, if the user checks the box it accepts it but deletes the other box that is checked for that user.

Let me word that better.

I started some code here:

Afterupdate of the checkbox, I want to make some code that will say if this is the first address, then check the box, if there is more than one address, uncheck any other box and check this one.

This would imply that the user is choosing what they want in the moment. They can change it back and forth, and all I am doing is making it so that they are really only checking 1 address at a time as primary. Any help would be great. This is the code I have so far. Just not sure on the if more than 1 uncheck other and check this...

Code:
--------------------------------------------------------------------------------
Private Sub chkPrimary_AfterUpdate()
On Error GoTo Err_chkPrimary_AfterUpdate

If Count(CandID) = 1 Then
Me.chkPrimary = True
ElseIf Count(CandID) > 1 Then
'uncheck other and check this one?



End If
Exit_chkPrimary_AfterUpdate:
Exit Sub

Err_chkPrimary_AfterUpdate:
MsgBox Err.Description
Resume Exit_chkPrimary_AfterUpdate
End Sub

--------------------------------------------------------------------------------

Thanks for any help!

:D
 

Users who are viewing this thread

Back
Top Bottom