Results 1 to 3 of 3

Thread: VBA Close Error

  1. #1
    Join Date
    Apr 2014
    Posts
    12

    Unanswered: VBA Close Error

    I have a form that shows all of my products and the details connected to that product. For each of the details I have a form to be able to add new options.

    For example Product Color. If I have a new product with a color not currently in the color table, I have a button on my product details form that opens a new form that shows all of the colors already in the database and allows me to add a new color. I use the VBA code below to update my combo box and it works great. The problem is I utilize the same color form in a different area of the database and it gives me an error when I try to close it if the product details form isn't open. Is there a way to close a form even if there is an error?

    Private Sub CloseForm_Click()
    Forms!frm_ProductDetails!cboProductColor.Requery
    On Error Resume Next
    DoCmd.Close
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    As suggested in your earlier thread. Your error handler needs to be BEFORE the the forms! Statement.


    mind you what you could do is open the coloyr form and pass tge name of the calling form as an opening argument and requery that control directly
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2014
    Posts
    12
    Thank you! Your first suggestion worked perfect. I am still brand new to Access without any formal training.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •