Update textbox in a form and subform VBA code (1 Viewer)

saledo2000

Registered User.
Local time
Today, 15:07
Joined
Jan 21, 2013
Messages
94
Hi there,
I have Combo box on a main form Registration where user select gender from drop down menu. Combo box pulls data from a table Gender (Male, Female, Child Male and Child Female), In that table I have a second column with Gender abbreviation (M, F, C/M and C/F). in the second form FL_form I would like to set data (M for Male, F for Female, C/M for Child Male or C/F for Child Female) to a textbox Gender_Symbol using event procedure on Open form. I have the same txtbox in a subform called FL_subform wher I want the same update. could you please help. this is my code.

If Me.Gender = "Male" Then
Me.Gender_Symbol = "M"

ElseIf Me.Gender = "Female" Then
Me.Gender_Symbol = "F"

ElseIf Me.Gender = "Chid Male" Then
Me.Gender_Symbol = "C/M"

ElseIf Me.Gender = "Child Female" Then
Me.Gender_Symbol = "C/F"
End If

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:07
Joined
Oct 29, 2018
Messages
21,358
Hmm, why would you want to do this on the Open event of the form. That would only update one record. Better yet, why even store this information again in multiple tables? You should be able to just look it up.
 

saledo2000

Registered User.
Local time
Today, 15:07
Joined
Jan 21, 2013
Messages
94
Thank you for your answer. You are correct. Will try another solution.

Thanks
 

Users who are viewing this thread

Top Bottom