Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2015
    Posts
    1

    Unanswered: Clearing an Unbound Combo box with Add New Record Button

    The title of this thread sounds like a simple problem, but I have been working on this for hours and cannot figure it out.

    I currently have a form with two unbound combo boxes that have a rowsource referencing a query. Once a selection has been made in the first combo box, it filters the results of the second unbound combobox.

    In addition, I also have a few bound text boxes that store user input and an add new record button. The issue I am having is clearing the comboboxes after the user hits add new record. The bound textboxes clear immediately and store information properly, but for some reason I cannot get the comboboxes to clear.

    Thus far, I can get it to work by using combobox="" if I make a new command button, but I would like to have the add new record button submit the record and then clear the boxes.

    It seems I can get it to work using the combobox="" if I do it as the FIRST line in the private sub for the add new record button, but then it clears the data before storing the information.... which, obvioiusly, is not what I want.

    If I add it beneath the rest of the code I have, then it doesn't clear. Am I missing something here? my code for the add new record button is below. Any help would be appreciated.

    Private Sub SubmitStatus_click()
    On Error GoTo Err_SubmitStatus_Click

    [User] = fOSUserName()

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.GoToRecord , , acNewRec

    Exit_SubmitStatus_Click:
    Exit Sub

    Err_SubmitStatus_Click:
    MsgBox Err.Description
    Resume Exit_SubmitStatus_Click

    DoCmd.RunSQL "INSERT INTO DailyStatusBackend (MasterProjectID)" & "Values(&me.combo14.column(6)&)"
    CurrentDb.Execute strSQL, dbFailOnError


    'this is where I have been adding the combobox="" and it doesn't work. Neither does me.combobox.value=null, me.combobox="", etc.

    End Sub

    Thank you again.

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    CboBox = null

Posting Permissions

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