Hi Tom
The disappearing message box was applied to this situation as a 'proof of concept' - in other words if I can do it here, then I can use the logic in other subs, and my users can be presented with 'status updates' (i.e. informed that an action was successful) without necessarily having to click Ok all the time. I envisage changing the timer to periods both longer and shorter than 3 seconds. But firstly I want to see if it can be done (so far yes, but not for my situation).
What does the sub do, in plain English?
On an Access form, the user selects a 'classification' in the combo box 'DelClassCombo' and then clicks a button 'Del_Class' - to try and delete a 'classification' from a table.
If the 'DelClassCombo' combo box is null (i.e. nothing was selected) then the sub just returns the cursor to the combo box and then does nothing - the code at the bottom is still inside the first Else statement. The message box will not appear if the first 'If' condition was met (i.e. the Null part). There are no procedures or subs attached to 'DelClassCombo' - it is just a combo box where the user selects a 'classification' from the combo box list. I could put an Exit Sub line after the
DoCmd.GoToControl "DelClassCombo"
line and it won't make any difference. There are no hidden subs or procedures.
If the DelClassCombo is not null (the else condition), then it tests to see if there are any records in the many side of a one-to-many relationship with the T_Clients table (i.e. how many clients in T_Clients have the selected 'classification'). If there are no matching records then it deletes the selected 'classification' and jumps to the
Message = "The classification value of...
part towards the bottom, and the disappearing message box is invoked.
If there are matching records, then the user can either do nothing (the else part where vbOK was not pressed and the sub exits), or they can delete the classification by pressing ok (the VbOk part). However, in this instance the code changes the T_Client records that were using the selected classification to a default classification value (i.e. the Dlookup...permanent = yes part). Again it proceeds to the
Message = "The classification value of...
part where the disappearing message box
Everything works perfectly and I replaced a standard MsgBox with your code - whilst the sub does everything it should, the new message box deosn't disappear after 3 (or more) seconds.
Hopefully that make sense. Thanks for looking at this.
Andrew