Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Location
    Saginaw, Texas
    Posts
    26

    Unanswered: Issue with requery combo

    I created a not_in_list event procedure using vba that inserts the data into table then opens form with that record to allow additional data to be added for that record. My problem when I close the form used for edit I have placed vba on close event of the dit form to requery the combo of the original open form where the not_in_list event originated. The issue is it does not refresh allowing the use of the newly created record. I have included vba code for both as review.

    not_in_list event vba

    Code:
    Private Sub cbo_ID_Part_NotInList(NewData As String, Response As Integer)
        ' Prompt user to verify data input is correct.
        Answer = MsgBox("Do you want to insert " & NewData & " into the Part Number list?", vbYesNo, "Part Number not found!")
        ' Answer yes = insert data into data table
        If Answer = vbYes Then
            Part = NewData
                SQLStmt = "Insert into tbl_Part(Part) values ('" & Part & "')"
                DoCmd.RunSQL SQLStmt
                Response = acDataErrAdded
                ' After data insert open form to add description not on this form
                DoCmd.OpenForm "frm_Part"
                DoCmd.GoToRecord , , acLast
                    Forms!frm_Part.Part.SetFocus
                    Forms!frm_Part.[Part] = Part
            End If
    
    End Sub
    Form Close event vba

    Code:
    Private Sub Form_Close()
    Forms!frm_PurchasesMain!frm_Purchases!frm_PurchasesDetails.cbo_ID_Part.Requery
    End Sub
    "Discovery consist in seeing what everyone sees and thinking what nobody has thought"

  2. #2
    Join Date
    May 2008
    Location
    Saginaw, Texas
    Posts
    26
    I stumbled on answer, I do not need to requery the original combo as it has been inserted via sql statement and the data entry clerk that closes the data edit form is returned to original form awaiting to finish the data entry.
    "Discovery consist in seeing what everyone sees and thinking what nobody has thought"

Posting Permissions

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