ledgerr.rob
Registered User.
- Local time
- Today, 04:18
- Joined
- Jun 3, 2012
- Messages
- 68
Hello Forum,
I have been having a little bit of an issue with a query crashing. I'm using a touch of VBA to run the operation so have landed in this forum but the query forum might be just as appropriate.
I have a form made to help query a database in a variety of ways. One of those is basically a wildcard search on the titles of the entries. This is a type of inventory DB and doing a basic search of a title seems important. I have between 500-600 items entered with a variety of related tables.
I first test the length of the search criteria to make sure something is being searched for. Once something is there, I open a report which has a record source of an underlying query. This query has criteria from the initial search criteria.
First i test the search criteria:
I open the report, causing the query to run. Query's SQL"
The [Item] field is indexed in the table. Also, when i put a break in the VBA it steps through just fine. Once I step it through the first time and remove the break it will operate fine. If i try to run without first performing the break Access will hang and restart.
Putting up a sample DB is a possibility once i have a little time. I'm sure that would help the community look into this issue. Short of that is there obvious errors in my approach?
I appreciate any ideas and thoughts.
I have been having a little bit of an issue with a query crashing. I'm using a touch of VBA to run the operation so have landed in this forum but the query forum might be just as appropriate.
I have a form made to help query a database in a variety of ways. One of those is basically a wildcard search on the titles of the entries. This is a type of inventory DB and doing a basic search of a title seems important. I have between 500-600 items entered with a variety of related tables.
I first test the length of the search criteria to make sure something is being searched for. Once something is there, I open a report which has a record source of an underlying query. This query has criteria from the initial search criteria.
First i test the search criteria:
Code:
Private Sub btnSearchItem_Click()
'run report rptItemSearch
txtSearchItem.SetFocus
If Len(Me!txtSearchItem.Text) = 0 Then
MsgBox ("You must enter an item to search for.")
Else
DoCmd.OpenReport "rptItemSearch", acViewReport
End If
End Sub
I open the report, causing the query to run. Query's SQL"
Code:
SELECT tblItem.Item, tblCategory.Category, tblOwner.OwnerFirst AS [Original Owner First], tblOwner.OwnerLast AS [Original Owner Last], tblOwner_1.OwnerFirst AS [Steward First], tblOwner_1.OwnerLast AS [Steward Last]
FROM tblOwner RIGHT JOIN (tblCategory RIGHT JOIN (tblItem LEFT JOIN tblOwner AS tblOwner_1 ON tblItem.CurrentStewardID = tblOwner_1.OwnerID) ON tblCategory.CategoryID = tblItem.CategoryID) ON tblOwner.OwnerID = tblItem.OriginalOwnerID
WHERE (((tblItem.Item) Like "*" & [Forms]![frmReportGenerator]![txtSearchItem] & "*"));
The [Item] field is indexed in the table. Also, when i put a break in the VBA it steps through just fine. Once I step it through the first time and remove the break it will operate fine. If i try to run without first performing the break Access will hang and restart.
Putting up a sample DB is a possibility once i have a little time. I'm sure that would help the community look into this issue. Short of that is there obvious errors in my approach?
I appreciate any ideas and thoughts.