hello all sorry for interrupting, i think my access file has some miss coding since i started from scratch in this project for my boss.
This Access has 2 Purposes,
1.- to input new Projects in the Form ( Client,Owner,General Contractor,Construction Management)
2. To check for new contacts.(this looks a little like outlook, it has a double click event)
Someone told me the problem is in the NotInTheList Event(he told me that it didnt allow my current form to requery) I am using LOOKUP FIELD because i dont know how to make a realtionship of one table with mutiple field in another table.
PROBLEM= When i type an owner or any type of contact in the form "Projects Info", it ask if i want to add, then the code searches for a record in the list of 7k contacts.(i purposely deleted, and altered the information for privacy reasons). and asked if the contact was found(if chek yes, then i will take you to the contact, if chek no it will take u to add newrecord.)
then i close it and the new contact is not requeried in the Field of the form Project Info.
Please help me to work with the code, i only have 2 weeks learning about coding without any help
Thank You in advanced.
I ADDED AN ATTACHEMENT
i could add my attachement so i will paste the code for NOt in the list Event
Code:
Private Sub Owner_NotInList(NewData As String, Response As Integer)
Dim MsgBoxAnswer As Integer
Response = acDataErrContinue
MsgBoxAnswer = MsgBox("Do you want to add " & NewData & " to the VCA List?", vbYesNo, "Add New Owner?")
If MsgBoxAnswer = vbYes Then
TextMiddenField = "AddOK"
DoCmd.OpenForm ("VCA Full Contact List")
DoCmd.FindRecord (NewData), , , , , acCurrent
FoundRecord = MsgBox("Did you find " & NewData & " in the List?", vbYesNo, "Found Contact")
If FoundRecord = vbYes Then
Response = acDataErrContinue
Else
DoCmd.GoToRecord , , acNewRec
End If
Else
Me.Owner = Null
DoCmd.GoToControl ("Owner")
End If
End Sub
i added the attachment it works now
This is the coding that some guys gave me and told me to paste in the the Project List form Module
Code:
Private Function ContactFound(ByVal ContactName As String) As Boolean
Const c_Criteria As String = "[Display Name] = '@N'"
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("Contacts", dbOpenSnapshot)
rst.FindFirst Replace(c_Criteria, "@N", ContactName)
If rst.NoMatch = False Then ContactFound = True
rst.Close
Set rst = Nothing
End Function