Brycey
noobish user :P
- Local time
- Today, 23:09
- Joined
- Apr 21, 2009
- Messages
- 12
Hi, I'm currently making a database for the purpose of logging maintenance calls. I have a form "Call Logging" with fields linked to a "Calls" table (Company, Date received, date closed, engineer, job description, solution description) In order to search the table from the form i inserted a "Call Search" button (code shown below) however, this button opens the query in Table view, how do i get it so that it shows the query results in the form from which i sent the command??
"Call Search" button code:
Private Sub Call_Search_Click()
'*******************************************
'Purpose: Driver to create a Query "Search Results"
' that will return table, field,
' items to search as prompted/
' entered by the operator.
Dim pTable As String
Dim pField As String
Dim pStuff As String
Dim strSQL As String
Dim qd As QueryDef
pTable = InputBox("Do you wish to search for 'Clients' or 'Calls'?", "Enter Source")
pField = InputBox("Enter field to search eg. 'Company', 'Date Received', 'Call Status'", "Enter Field")
pStuff = InputBox("Enter items to search for -- separate by comma (no spaces)", "Enter Items")
strSQL = "Select [" & pTable & "].* From [" & pTable & "] WHERE " & MultiParms(pStuff, pField)
Debug.Print strSQL
'Create Query
Set qd = CurrentDb.CreateQueryDef("Search Results", strSQL)
'Open / view new query
DoCmd.OpenQuery qd.Name
'Delete Query
CurrentDb.QueryDefs.Delete qd.Name
End Sub
Any help will be greatly appreciated
"Call Search" button code:
Private Sub Call_Search_Click()
'*******************************************
'Purpose: Driver to create a Query "Search Results"
' that will return table, field,
' items to search as prompted/
' entered by the operator.
Dim pTable As String
Dim pField As String
Dim pStuff As String
Dim strSQL As String
Dim qd As QueryDef
pTable = InputBox("Do you wish to search for 'Clients' or 'Calls'?", "Enter Source")
pField = InputBox("Enter field to search eg. 'Company', 'Date Received', 'Call Status'", "Enter Field")
pStuff = InputBox("Enter items to search for -- separate by comma (no spaces)", "Enter Items")
strSQL = "Select [" & pTable & "].* From [" & pTable & "] WHERE " & MultiParms(pStuff, pField)
Debug.Print strSQL
'Create Query
Set qd = CurrentDb.CreateQueryDef("Search Results", strSQL)
'Open / view new query
DoCmd.OpenQuery qd.Name
'Delete Query
CurrentDb.QueryDefs.Delete qd.Name
End Sub
Any help will be greatly appreciated