Thebounder
Programmer
I currently have a database which contains the following tables:
Customer_Details
Customer_Number
Customer_Name
Address_Line_1
...
Invoice_Number
Invoice_Details
Sub_Invoice_Number - Primary Key
Invoice_Number
Details
I want to display both tables on the same form.
This is no problem.
But I want to be able to search any of the fields of the form.
I have created another table containing all the fields but I don't know where to do from there!!!
Dim MyDB As Database
Dim MyWorkspace As Workspace
Set MyWorkspace = DBEngine.Workspaces(0)
Set MyDB = MyWorkspace.Databases(0)
Dim stDocName As String
Dim stLinkCriteria As String
Dim SearchForm As Boolean
SearchForm = False
stDocName = "Search_Customer_Invoice"
stLinkCriteria = ""
' Search for the Part Number
If Not IsNull(Current_Date) And Current_Date <> "" Then
stLinkCriteria = stLinkCriteria + _
"[Current_Date] LIKE " & "'*" & Me![Current_Date] & "*'" & " AND "
SearchForm = True
End If
......
If SearchForm = True Then
If Right(stLinkCriteria, 5) = " AND " Then
stLinkCriteria = Left(stLinkCriteria, Len(stLinkCriteria) - 5)
End If
Set ComponentDetails = MyDB.OpenRecordset("Invoice_Table", DB_OPEN_DYNASET)
ComponentDetails.FindFirst stLinkCriteria
If ComponentDetails.NoMatch Then
Dim msgbox_result As Integer
msgbox_result = MsgBox("There are no matching records", 49, "No Matching Records"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
Rem DoCmd.Close acForm, SearchDocForm
End If
End If
Many thanks
TimS