0

I have a very simple form with one field to add records to a DB. After successful record insertion, a success message is displayed. How can I hide the success label after X seconds? [record_save_success] is just a static text label. Here's what I'm doing to show the message:

Private Sub Form_AfterInsert()
  [record_save_success].Visible = True
End Sub

Can I add a delay to change the Visible property to False?

braX
  • 11,506
  • 5
  • 20
  • 33
RyGuy
  • 508
  • 6
  • 18
  • Timers are difficult and memory hogs. Form has Timer event, controls do not. Maybe just make sure control is not visible with form Current event. – June7 May 05 '20 at 18:28
  • Using the Form_Current() event is a good idea, however the success message disappears almost instantly after a record is saved since the cursor defaults to the text field. – RyGuy May 05 '20 at 18:45
  • I did not say to remove AfterInsert code. It was not an either/or suggestion. Use both. However, what triggers record commitment? Will record stay in view long enough for user to see message? – June7 May 05 '20 at 18:46
  • Does this answer your question? [Timing Delays in VBA](https://stackoverflow.com/questions/6960434/timing-delays-in-vba) Okay, don't need Timer event, use Wait or Sleep or timer loop in Current event. https://www.myonlinetraininghub.com/pausing-or-delaying-vba-using-wait-sleep-or-a-loop – June7 May 05 '20 at 18:57
  • Yes!!! That question was what I was looking for!! The second answer posted on that question was just what I needed!!! thanks! – RyGuy May 05 '20 at 19:08
  • On second thought, can probably have timer code in AfterInsert event. – June7 May 05 '20 at 19:10

0 Answers0