Hi FLL
What you are asking is not to hard. First of all I would have two forms for searching, one for your main customer table, and one for your purchase table. Then have several list boxes and text boxes to get the information the user wants to search by (List or Text depend on how much searchability you want to give to the user for each of the fields). Then when the user clicks on the search button, using ADO or DAO create a connection to the database and build a SQL statement depending on what search criteria the user has entered. Below is something like what you will need
Hope this helpsCode:Dim ObjCon As ADODB.Connection Dim ObjRec As ADODB.Recordset Dim strSql As String Dim strCon As String Set ObjCon = New ADODB.Connection Set ObjRec = New ADODB.Recordset Strcon = "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=nwind.mdb;" & _ "DefaultDir=C:\programfiles\devstudio\b;" & _ "Uid=Admin;Pwd=;" ObjCon.Open Strcon StrSql = "SELECT * FROM Customer" if Text1.value <> "" Then StrSql = StrSql & " WHERE customerid = " & Text1.value End If 'etc etc for your different fields, you will need to add a 'little function to see whether to put in a WHERE or an AND 'in the code ObjRec.Open strSql, ObjCOn 'Then you can use the recordset to populate what ever you want the search to be displayed in ObjRec.Close ObjCon.Close Set ObjCon = Nothing Set ObjRec = Nothing
Ian




Reply With Quote