showing , hiding fields based on previous entry

m9jiihmr@gmail.com

New member
Local time
Tomorrow, 02:39
Joined
Jun 11, 2013
Messages
13
Hello

I am using Microsoft Access 2010.
I have a form, having following fields

Nationality, Combo box, Options are Indian/foreign
State: With list of States in India.

What I want is, when data entry operator , select, Foreign, State field automatically hides.
And when data entry operator , select Indian,
State field shows in the form.


How this can be done in Access 2010

Thanks and Regards
Manoj
 
You would use th AfterUpdate event of the Nationality Combo Box.
Code:
Private Sub [COLOR=Blue]NationalityComboBox[/COLOR]_AfterUpdate()
    If Me.[COLOR=Blue]NationalityComboBox[/COLOR] = "India" Then
        Me.[COLOR=Blue]StatesBox[/COLOR].Visible = True
    Else
        Me.[COLOR=Blue]StatesBox[/COLOR].Visible = False
    End If
End Sub
Match your design of course.
 
Last edited by a moderator:
I prefer this variation:

Code:
Private Sub NationalityComboBox_AfterUpdate()

     Me.StatesBox.Visible = (Me.NationalityComboBox = "India")

End Sub
 
Thanks to all
It Works.

May I ask another query here in this thread.

In a table, where participantid is set as primary key, in this table there are two more fields, Name and Organisation.

However, in a table , participantid takes a different value for a different records.

But my query is,

Even for a different participantid, I want to check, whether there is same Name and Organisation record exist in the table, if yes shows warning.

Example:


ParticipantId Name Organisation

23 M MNO

Now when user enters next record,
that is 24,
and by mistake he/she enters , again like
24 M MNO

So during record saving or moving to next record, there should show some warning,

Same record found, you want to accept it, with two options. Yes, No,

If Yes, Record saves in table, If No, then does not Save.

Please suggest.
Thanks and Regards
Manoj
 

Users who are viewing this thread

Back
Top Bottom