i give up!!
okay, so i've been trying all sorts of things and i just cannot get this to work. my code is below.
What currently works:
If user tries to enter an author that is not in the list, the not in list event is triggered. This opens popup form, frmAuthorEntry. The fields are already populated due to passed args. There is a command button to close the popup and return to the main form.
What does not work:
Once I close the popup, the access error message says the item i'm trying to add isn't in the list. BUT IT IS. I just have to re-select or re-type it.
I have been stumped on this for a very long time now.
Every single other combo box notinlist event works for me and I cannot for the life of me figure out why this is not working.
The cboAuthor is based on a query that concatenates the the first and last name.
If i start putting things in that are supposed to requery, i get a msg error 2118, save before requery. even if i add the save button and then close the form with the X in the corner, it STILL does the whole error msg thing about not in the list until i re-type or select from drop down. but it's supposed to already requery based on the response=acDataErrAdded thing. arrggghhhhhhh!!!!!!!!!!!!!!!!!
nothing i try has worked. i've tried docmd stuff to save or close, and that doesn't work, it tells me the popup is empty, [frmAuthorEntry=Empty]
i have NO idea what that means.
this is the only thing preventing me from finishing this database.
Here is my code for NotInList:
Private Sub cboAuthor_NotInList(NewData As String, Response As Integer)
On Error GoTo cboAuthor_NotInList_Err
If MsgBox("The author " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo + vbDefaultButton1, "Appell Library") = vbYes Then
DoCmd.OpenForm "frmAuthorEntry", , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
MsgBox "Please choose an author from the list." _
, vbInformation, "Appell Library"
Response = acDataErrContinue
End If
cboAuthor_NotInList_Exit:
Exit Sub
cboAuthor_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboAuthor_NotInList_Exit
End Sub
-----------------
Code for the popup form OnLoad
Private Sub Form_Load()
Dim Args As Variant
If Not IsNull(Me.OpenArgs) Then
Args = Split(Me.OpenArgs, ",")
Me.AuthorLastName = Args(0)
Me.AuthorFirstName = Args(1)
End If
End Sub