R
Richard
I am working on a multi-user form / subform one to many relationship. Two
data tables, master table (tblWarehouse) primary key set to WarehouseID /
autonumber child table (tblPurchData) primary key set to PurchaseOrderID /
autonumber with a foreign key WarehouseID from the master table. I am using a
small popup form for searching, this is woking great with the master table
(tblWarehouse), but I also need to search the the child table (tblPurch).
Below is the code I am using for my search function.
************************************************************
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
'Filter Form1 based on search criteria
Form_ListFrm.RecordSource = "select * from tblWarehouse where " &
GCriteria
'Form_ListFrm.Caption = "tblWarehouse (" & cboSearchField.Value & "
contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmSearch"
'Open report
DoCmd.OpenReport "rptWarehouse", acViewPreview, , GCriteria
DoCmd.Maximize
'MsgBox "Results have been filtered."
End If
End Sub
************************************************************
Can I add my child table before the "where" claus? or does it go on the
properties sheet of the popup form. Thank you.
data tables, master table (tblWarehouse) primary key set to WarehouseID /
autonumber child table (tblPurchData) primary key set to PurchaseOrderID /
autonumber with a foreign key WarehouseID from the master table. I am using a
small popup form for searching, this is woking great with the master table
(tblWarehouse), but I also need to search the the child table (tblPurch).
Below is the code I am using for my search function.
************************************************************
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
'Filter Form1 based on search criteria
Form_ListFrm.RecordSource = "select * from tblWarehouse where " &
GCriteria
'Form_ListFrm.Caption = "tblWarehouse (" & cboSearchField.Value & "
contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmSearch"
'Open report
DoCmd.OpenReport "rptWarehouse", acViewPreview, , GCriteria
DoCmd.Maximize
'MsgBox "Results have been filtered."
End If
End Sub
************************************************************
Can I add my child table before the "where" claus? or does it go on the
properties sheet of the popup form. Thank you.