John Vinson said:
Please copy and paste your code; indicate the name of the Form, the
Name properties of the street field and of the combo box, and the name
of the table.
John W. Vinson[MVP]
John,
I messed with this to much i suspect and now even after starting from
scratch i cant get the Yes No prompt back. I just get a cant execute code in
design mode error.
Anyways here's the code as i have it now which i believe is exactly as i had
it when i got the Yes No prompt.
Form Name is "Contacts" Combo Box name is "Combo34" Name Property for the
street field is the same as the Combo Box "Combo34"
and the name of the Table (the one that contains the street names) is
"Streets"
I hate to even ask this now but now that im using a combo box for the Street
name and for the 2 zip codes, they don't appear in a Report im generating
from this form. Would you happen to know if that's an easy fix?
Thanks for your help it is much appreciated
Mike
The Code:
Private Sub Combo34_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available AE Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to associate the new Name to the current
DLSAF?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to re-type
it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblAE", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AEName = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub