Greetings. In my app there is a customer data form and prospect data form. Once a sales person gets a lead they use a search function to see if that lead exists in our db as a customer or prospect. If not they will use several websites to gather information about that lead. Typically the rep will input the same information 4-6 times not including the db search.
Could anyone guide me in a direction where the rep enters the search info on the db search form and if the search fails have the data passed to websites ie.google,ect?
It would be nice to have the results returned to text field in the db stripped of ads and such. However, multiple instances of explorer is ok too.
I don't expect for someone to do it for me but any help/tips will be appreciated.
Here is the code for my search.
Thanks
Option Compare Database
Private Sub cmdSearch_Click()
PerformSearch
End Sub
Private Sub lstResults_DblClick(Cancel As Integer)
Dim lRec As Integer
lRec = Nz(lstResults.Value, 0)
If lRec > 0 Then Me.Parent.OpenRec (lRec)
End Sub
Private Sub PerformSearch()
Dim sSQL As String
sSQL = "Select distinct tblCustomer.lCustomerID, tblCustomer.sStatus as Status, tblCustomer.sFirstName as FName, tblCustomer.sLastName as LName, tblCustomer.sSCity as City, tblCustomer.sSZip as Zip, tblCustomer.sCompany as Company from tblCustomer "
sSQL = sSQL + "left outer join tblOrder on tblCustomer.lCustomerID = tblOrder.lCustomerID "
sSQL = sSQL + "where tblCustomer.sStatus in ('D','P','C')"
If Not IsNull(txtFirstName.Value) Then sSQL = sSQL + " and sFirstName like '%" & txtFirstName.Value & "%'"
If Not IsNull(txtLastName.Value) Then sSQL = sSQL + " and sLastName like '%" & txtLastName.Value & "%'"
If Not IsNull(txtCity.Value) Then sSQL = sSQL + " and sSCity like '%" & txtCity.Value & "%'"
If Not IsNull(txtZip.Value) Then sSQL = sSQL + " and sSZip like '" & txtZip.Value & "'"
If Not IsNull(txtCompany.Value) Then sSQL = sSQL + " and sCompany like '%" & txtCompany.Value & "%'"
If Not IsNull(txtPhone.Value) Then sSQL = sSQL + " and (sWorkPhone like '%" & txtPhone.Value & "%' or sMobilePhone like '%" & txtPhone.Value & "%')"
If Not IsNull(txtOrderNumber.Value) Then sSQL = sSQL + " and lOrderID = " & txtOrderNumber.Value & " "
sSQL = sSQL + " order by sLastName;"
lstResults.RowSource = sSQL
'Debug.Print sSQL
lstResults.Requery
End Sub
Private Sub txtCity_AfterUpdate()
PerformSearch
End Sub
Private Sub txtCompany_AfterUpdate()
PerformSearch
End Sub
Private Sub txtFirstName_AfterUpdate()
PerformSearch
End Sub
Private Sub txtLastName_AfterUpdate()
PerformSearch
End Sub
Private Sub txtOrderNumber_AfterUpdate()
PerformSearch
End Sub
Private Sub txtPhone_AfterUpdate()
PerformSearch
End Sub
Private Sub txtZip_AfterUpdate()
PerformSearch
End Sub
Could anyone guide me in a direction where the rep enters the search info on the db search form and if the search fails have the data passed to websites ie.google,ect?
It would be nice to have the results returned to text field in the db stripped of ads and such. However, multiple instances of explorer is ok too.
I don't expect for someone to do it for me but any help/tips will be appreciated.
Here is the code for my search.
Thanks
Option Compare Database
Private Sub cmdSearch_Click()
PerformSearch
End Sub
Private Sub lstResults_DblClick(Cancel As Integer)
Dim lRec As Integer
lRec = Nz(lstResults.Value, 0)
If lRec > 0 Then Me.Parent.OpenRec (lRec)
End Sub
Private Sub PerformSearch()
Dim sSQL As String
sSQL = "Select distinct tblCustomer.lCustomerID, tblCustomer.sStatus as Status, tblCustomer.sFirstName as FName, tblCustomer.sLastName as LName, tblCustomer.sSCity as City, tblCustomer.sSZip as Zip, tblCustomer.sCompany as Company from tblCustomer "
sSQL = sSQL + "left outer join tblOrder on tblCustomer.lCustomerID = tblOrder.lCustomerID "
sSQL = sSQL + "where tblCustomer.sStatus in ('D','P','C')"
If Not IsNull(txtFirstName.Value) Then sSQL = sSQL + " and sFirstName like '%" & txtFirstName.Value & "%'"
If Not IsNull(txtLastName.Value) Then sSQL = sSQL + " and sLastName like '%" & txtLastName.Value & "%'"
If Not IsNull(txtCity.Value) Then sSQL = sSQL + " and sSCity like '%" & txtCity.Value & "%'"
If Not IsNull(txtZip.Value) Then sSQL = sSQL + " and sSZip like '" & txtZip.Value & "'"
If Not IsNull(txtCompany.Value) Then sSQL = sSQL + " and sCompany like '%" & txtCompany.Value & "%'"
If Not IsNull(txtPhone.Value) Then sSQL = sSQL + " and (sWorkPhone like '%" & txtPhone.Value & "%' or sMobilePhone like '%" & txtPhone.Value & "%')"
If Not IsNull(txtOrderNumber.Value) Then sSQL = sSQL + " and lOrderID = " & txtOrderNumber.Value & " "
sSQL = sSQL + " order by sLastName;"
lstResults.RowSource = sSQL
'Debug.Print sSQL
lstResults.Requery
End Sub
Private Sub txtCity_AfterUpdate()
PerformSearch
End Sub
Private Sub txtCompany_AfterUpdate()
PerformSearch
End Sub
Private Sub txtFirstName_AfterUpdate()
PerformSearch
End Sub
Private Sub txtLastName_AfterUpdate()
PerformSearch
End Sub
Private Sub txtOrderNumber_AfterUpdate()
PerformSearch
End Sub
Private Sub txtPhone_AfterUpdate()
PerformSearch
End Sub
Private Sub txtZip_AfterUpdate()
PerformSearch
End Sub