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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close a form based on input value 1

Status
Not open for further replies.

carwil

Technical User
Feb 7, 2006
4
US
Can a form be closed based on an input value in a text box?

For example, if it a date is entered that is >=date() then display a message for a specific length of time (6 sec) then close the form.

Thanks!

 
You can not make a standard msgbox close after a given period of time, but here is some code for a good work around. You can build your own form, but this provides a lot of flexibility.
Code:
Private Sub txtBxCloseOnValue_AfterUpdate()
  If Me.txtBxCloseOnValue = "Close" Then
    MsgBox "You entered 'Close'. About to Close", vbinfo, "CLOSING"
    DoCmd.Close acForm, Me.Name
  End If
End Sub
If you desire replace the Msgbox with a call to the code from the link above. Then you can use set the display time.
 
MajP,
Thank you so much. This is exactly what I was looking for. I also appreciate the link. Another good source of information.

Have a great day! [wavey3]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top