so confused

nomojo

Registered User.
Local time
Today, 10:03
Joined
Jun 22, 2012
Messages
14
I have a form that involves a block if statement in the OnPaint event.
The form is set to continuous forms view.
As soon as i placed the code in the onpaint event, the forms that are not the focus keep flickering, if i change the focus the flickering changes, so that those that do not have the focus are always the ones flickering.

It may be possible that I could place the code somewhere else, to achieve what i need, but in the onpaint event is the first time it has worked correctly, minus the flickering.

I have three yes/no fields in the linked table to select gender. The block if (included below) determines which of the fields is selected, and puts a particular value in a text field on the form. I have the fields on the table set to yes/no fields so that i can have a sum for each of the gender options on a report. The text field on the form is not linked to anything.

again, i may be going about this completely backwards.

any and all help is appreciated.

code:

If Me.GenderMale = True Then
Me.Text21 = "Male"
ElseIf Me.GenderFemale = True Then
Me.Text21 = "Female"
ElseIf Me.GenderOther = True Then
Me.Text21 = "Other"
Else
Me.Text21 = "Unknown"
End If
 
Why are you using the On Paint event? You should not need that for a form, especially for the code you have. The code you have should go in a separate Procedure (Sub) in the form that you have this on and then each checkbox should call it in its AfterUpdate event and you will also want it to be called from the Form's Current event so that when you go from record to record the correct value will be displayed based on the checkbox selections.
 
That works for single form view, but in continuous or data sheet, all the records say the same gender when you check one of the options. for example, if i check male in one record, all of them say male, while their respective check boxes may say otherwise. i would like to be able to see all the records at once, and see the gender selected with out checkboxes.

the other option i could do, even though i dont know how, is to have a single text box, in which the user could type in the gender, but, and this is what i dont know how to do, i would need to count up how many of each gender was typed in. ie how many records are males.
 
The checkbox needs to be bound to a field in the table to store the value. It sounds like it isn't because otherwise it wouldn't change for all records.
 
The checkboxes are bound to fields in the table. they are yes/no fields. the text box is not, because it is simply for display purposes
 
alrighty, bound the textbox everything is working as expected. thank you very much!
 
...the text box is not, because it is simply for display purposes
If you want it to display correctly on a continuous form or datasheet form, you will need to have a field to store that in the table and bind the control to it. Unbound controls on a continuous form LOOK like there are numerous ones there but, in fact, they are only an illusion.
 

Users who are viewing this thread

Back
Top Bottom