Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msgbox procedural problem

Status
Not open for further replies.

lachesis

Technical User
Sep 25, 2002
138
NZ
I'm having a general problem with a msgbox - not a big one - just a procedural one i think.

On a form (fmProducts) there are two combo boxes: cboCategory and cboFeature. When the user selects a Category code (cboCategory), this selection filters the list result in cboFeature. However when there are no Features associated with a Category, I want to display a msgbox with the option for the user to add New Features.

At the moment I have the msgbox activating in the GotFocus event of the Features combo box.

If me.cboFeature.listcount then
' do this, listcount is true
...
Else
' do this, listcount is false
Dim response
response = Msgbox("Do you want to add New Features?, vbYesNo)
If response = vbYes then
Docmd.OpenForm "fmAddFeatures"
Else ' no
' do nothing
End If
End if

When the user clicks "Yes" form fmAddFeatures fires up, and the user adds the new features associated with the Category code lasted used on the previous form. However when the user closes out of fmAddFeatures, the msgbox from fmProducts is still active. How do I prevent this? After all the user has already made the selection from Yes/No - they do not need to do it again.

thanks L.
 
the problem is that the GotFocus event is firing again when you return to the form and the list isn't populated so the messagebox is appearing again. Just sort it out so that you set a flag or something, or repopulate the list as soon as the person is done adding features, before you close the addfeature form. That should do the trick, lemme know how it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top