Automatically changing yes/no box

stuart_adair

Registered User.
Local time
Today, 06:27
Joined
Jan 13, 2009
Messages
57
Hello all, got another problem that I'm sure you lot will sort in a flash.

On a form I've got 2 yes/no fields. One called photo required and one called photo match.

Photo required may be yes or no but will usually be yes.

When a user clicks photo match as yes I want photo required to automatically change to no.

Thanks
Stu
 
In the after update event of the PhotoMatch checkbox put:

Me.PhotoRequired = Not Me.PhotoMatch

And substitute the actual control names for each.
 
Thanks for the quick reply Bob. I'm not sure what you mean by the control names though.
I've entered Me.Photo Required = Not Me.Photo Match in the After Update box on the photo match properties and am getting the message "Cant find the macro me"

thanks
Stu
 
I've entered Me.Photo Required = Not Me.Photo Match in the After Update box on the photo match properties and am getting the message "Cant find the macro me"
It goes in the VBA window, not the properties. See here...

And as for the names, what I mean is to make sure that you use the actual names of the controls (checkboxes) instead of the names I used. Also, if you have spaces in the names you have to put square brackets around them:

Me.[Photo Required] = Not Me.[Photo Match]

(another good reason to NOT use spaces in field or object names)
 
Thanks Bob - Still not working though.

I've selected Event Procedure and the code reads as below (Note fields do have spaces)

Private Sub photo_match_AfterUpdate()
Me.[photo required] = Not Me.[Photo match]
End Sub
 
Thanks Bob - Still not working though.
When you say, "not working" what does that mean? Are you getting an error message? Are you sure the event is firing (put a breakpoint to make sure)? If need be, put a copy of the database up with that form (and whatever tables/queries support it - no data is fine).
 
I know the event is firing because when I changed photo match to XXX in the event procedure I got an error message.

I can click on photo match but nothing happens to photo required. The logic that I want to say is "If photo match = true then photo required = false"

Not sure how to put a copy of the database up ?

Thanks for your patience
Stu
 
I know the event is firing because when I changed photo match to XXX in the event procedure I got an error message.
What error message? I can't mind read - so something like that should be provided.
I can click on photo match but nothing happens to photo required. The logic that I want to say is "If photo match = true then photo required = false"
My code uses that logic - just in a more compact sense.
Not sure how to put a copy of the database up ?
See here
 
Righto. Because of the confidential information in the database I'd be breaking the law sending out with real data so I've removed just about everything apart from the form and 2 fields where I have the question.

Autoexec opens the form. Shift and open file bypasses this.

2 fields on the right are photo required and photo match. Photo required is currently set to true.

I want to be able to click true to photo match and photo required will automatically change to false.

Thanks
Stu
 

Attachments

Your problem appears to be that you tried putting the code (including changing the code) to the wrong control. You don't have a checkbox named Photo Match or Photo Required. You have checkboxes named Check79 (for photo required) and Check85 (for Photo Match).

The code would go in the After Update event of Check85 and it would be:

Code:
Private Sub Check85_AfterUpdate()
   Me.Check79 = Not Me.Check85
End Sub
 

Users who are viewing this thread

Back
Top Bottom