Hello,
I have a form that contains a few combo boxes, but I am trying to force the fields to be filled, therefore idf the first field is not filled up you cannot go to the second...This works fine but the problem occurs when I choose data from a combo box and then if I decide to erase with data with the delete key on the keyboard, my program doesn't work, I don't get prompt with my messages...
this is my code
Private Sub categorie_AfterUpdate()
'If the category chosen is equal to "autre" then automatically
'assign "VOIR COMMENTAIRES" to the Description combo box and
'then go to combo box named Lieux and drop down the list of available items.
If Categorie = "autre" Then
Me.description = "VOIR COMMENTAIRES"
DoCmd.GoToControl "lieux"
Me.ActiveControl.Dropdown
Else
'If the description combo box is empty then go to description
'combo box and refresh the combo box and then automatically
'drop down the list of available items to choose.
Me.description = ""
DoCmd.GoToControl "description"
Me.description.Requery
Me.ActiveControl.Dropdown
End If
End Sub
Private Sub description_AfterUpdate()
' After you have chosen a description go to the following combo box
' named "lieux" and open the drop down list.
DoCmd.GoToControl "lieux"
Me.ActiveControl.Dropdown
End Sub
Private Sub description_GotFocus()
If IsNull(Categorie) Then
Categorie.SetFocus
MsgBox "Vous devez choisir une categorie", vbInformation
End If
Me.Refresh
End Sub
Private Sub lieux_AfterUpdate()
' After you have chosen a location go to the following combo box
' named "Niveau" refresh the combo box and open the drop down list.
Me.Niveau = ""
Me.Niveau.Requery
DoCmd.GoToControl "niveau"
Me.ActiveControl.Dropdown
End Sub
Private Sub lieux_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Then
MsgBox "Vous devez choisir une description", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
Else
IsNull (description)
description.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub niveau_AfterUpdate()
' After you have chosen a Level go to the following combo box
' named "Emplacement" refresh the combo box and open the drop down list.
Me.Emplacement = ""
Me.Emplacement.Requery
DoCmd.GoToControl "emplacement"
Me.ActiveControl.Dropdown
End Sub
Private Sub niveau_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Then
MsgBox "Vous devez choisir un lieux", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
Else
IsNull (Lieux)
Lieux.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub emplacement_AfterUpdate()
' After you have chosen a emplacement go to the following combo box
' named "précisions" refresh the combo box and open the drop down list.
Me.précisions = ""
Me.précisions.Requery
DoCmd.GoToControl "précisions"
Me.ActiveControl.Dropdown
End Sub
Private Sub emplacement_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Or _
IsNull(Niveau) Then
MsgBox "Vous devez choisir un niveaux", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
ElseIf IsNull(Lieux) Then
Lieux.SetFocus
Else
IsNull (Niveau)
Niveau.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub précisions_AfterUpdate()
' Refresh the telephone text box and go to the NoEpl control and drop down the
' list of employees
Me.Telephone.Requery
DoCmd.GoToControl "NoEmpl"
Me.ActiveControl.Dropdown
End Sub
Private Sub précisions_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Or _
IsNull(Niveau) Or _
IsNull(Emplacement) Then
MsgBox "Vous devez choisir un emplacement", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
ElseIf IsNull(Lieux) Then
Lieux.SetFocus
ElseIf IsNull(Niveau) Then
Niveau.SetFocus
Else
IsNull (Emplacement)
Emplacement.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub NoEmpl_AfterUpdate()
' Refresh the Combo Box NoEmpl after the update
Me.DemandeurNom.Requery
End Sub
I have a form that contains a few combo boxes, but I am trying to force the fields to be filled, therefore idf the first field is not filled up you cannot go to the second...This works fine but the problem occurs when I choose data from a combo box and then if I decide to erase with data with the delete key on the keyboard, my program doesn't work, I don't get prompt with my messages...
this is my code
Private Sub categorie_AfterUpdate()
'If the category chosen is equal to "autre" then automatically
'assign "VOIR COMMENTAIRES" to the Description combo box and
'then go to combo box named Lieux and drop down the list of available items.
If Categorie = "autre" Then
Me.description = "VOIR COMMENTAIRES"
DoCmd.GoToControl "lieux"
Me.ActiveControl.Dropdown
Else
'If the description combo box is empty then go to description
'combo box and refresh the combo box and then automatically
'drop down the list of available items to choose.
Me.description = ""
DoCmd.GoToControl "description"
Me.description.Requery
Me.ActiveControl.Dropdown
End If
End Sub
Private Sub description_AfterUpdate()
' After you have chosen a description go to the following combo box
' named "lieux" and open the drop down list.
DoCmd.GoToControl "lieux"
Me.ActiveControl.Dropdown
End Sub
Private Sub description_GotFocus()
If IsNull(Categorie) Then
Categorie.SetFocus
MsgBox "Vous devez choisir une categorie", vbInformation
End If
Me.Refresh
End Sub
Private Sub lieux_AfterUpdate()
' After you have chosen a location go to the following combo box
' named "Niveau" refresh the combo box and open the drop down list.
Me.Niveau = ""
Me.Niveau.Requery
DoCmd.GoToControl "niveau"
Me.ActiveControl.Dropdown
End Sub
Private Sub lieux_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Then
MsgBox "Vous devez choisir une description", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
Else
IsNull (description)
description.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub niveau_AfterUpdate()
' After you have chosen a Level go to the following combo box
' named "Emplacement" refresh the combo box and open the drop down list.
Me.Emplacement = ""
Me.Emplacement.Requery
DoCmd.GoToControl "emplacement"
Me.ActiveControl.Dropdown
End Sub
Private Sub niveau_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Then
MsgBox "Vous devez choisir un lieux", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
Else
IsNull (Lieux)
Lieux.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub emplacement_AfterUpdate()
' After you have chosen a emplacement go to the following combo box
' named "précisions" refresh the combo box and open the drop down list.
Me.précisions = ""
Me.précisions.Requery
DoCmd.GoToControl "précisions"
Me.ActiveControl.Dropdown
End Sub
Private Sub emplacement_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Or _
IsNull(Niveau) Then
MsgBox "Vous devez choisir un niveaux", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
ElseIf IsNull(Lieux) Then
Lieux.SetFocus
Else
IsNull (Niveau)
Niveau.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub précisions_AfterUpdate()
' Refresh the telephone text box and go to the NoEpl control and drop down the
' list of employees
Me.Telephone.Requery
DoCmd.GoToControl "NoEmpl"
Me.ActiveControl.Dropdown
End Sub
Private Sub précisions_GotFocus()
If IsNull(Categorie) Or _
IsNull(description) Or _
IsNull(Lieux) Or _
IsNull(Niveau) Or _
IsNull(Emplacement) Then
MsgBox "Vous devez choisir un emplacement", vbInformation
If IsNull(Categorie) Then
Categorie.SetFocus
ElseIf IsNull(description) Then
description.SetFocus
ElseIf IsNull(Lieux) Then
Lieux.SetFocus
ElseIf IsNull(Niveau) Then
Niveau.SetFocus
Else
IsNull (Emplacement)
Emplacement.SetFocus
End If
End If
Me.Refresh
End Sub
Private Sub NoEmpl_AfterUpdate()
' Refresh the Combo Box NoEmpl after the update
Me.DemandeurNom.Requery
End Sub