Kiwi-Wombat
Registered User.
- Local time
- Today, 12:51
- Joined
- Aug 2, 2004
- Messages
- 56
Hi
I have a pop-up form as part of my project which contains 4 unrelated tables. Each table has a AutoNumber as the key and one text field.
The record source for the form is
The form contains 4 list boxes. Each one has the relevant table/field as the table/query row source). The user double clicks on an item in any one of the list boxes which transfers the selected item to another field. This builds up a sentence which eventually is transfered to the original calling form.
The code for selecting the items is (note the variables are defined elsewhere):
This works Ok but my difficulty is that although each table has only about 50 items, if you select the last item in the last table it takes at least 3 seconds to transfer the selection to the separate field. The more records you add the longer it takes.
If you add another table the the form's record source, the delay is such that the form 'hangs'.
The only reason for having the tables in the form's record source is that is the only way I can do a search using RecordsetClone.
Does anyone have another suggestion?
I have a pop-up form as part of my project which contains 4 unrelated tables. Each table has a AutoNumber as the key and one text field.
The record source for the form is
SELECT tblFractions.*, tblUnitsOfMeasure.*, tblIngredients.*, tblPreparation.* FROM tblFractions, tblUnitsOfMeasure, tblIngredients, tblPreparation;
The form contains 4 list boxes. Each one has the relevant table/field as the table/query row source). The user double clicks on an item in any one of the list boxes which transfers the selected item to another field. This builds up a sentence which eventually is transfered to the original calling form.
The code for selecting the items is (note the variables are defined elsewhere):
Private Sub SelectItem_Click()
Dim rst As Recordset
Set rst = Me.RecordsetClone
If varFractions Then
rst.FindFirst "FractionsID = " & FractionsList
ElseIf varUnitMeasure Then
rst.FindFirst "UnitMeasureID = " & UnitMeasureList
ElseIf varIngredient Then
rst.FindFirst "IngredientID = " & IngredientsList
ElseIf varPreparation Then
rst.FindFirst "PreparationID = " & PreparationList
End If
Me.Bookmark = rst.Bookmark
If varFractions Then
InsertionString = InsertionString & Fraction & " "
ElseIf varUnitMeasure Then
InsertionString = InsertionString & UnitMeasure & " "
ElseIf varIngredient Then
InsertionString = InsertionString & Ingredient & " "
ElseIf varPreparation Then
InsertionString = InsertionString & Preparation & " "
End If
End Sub
Dim rst As Recordset
Set rst = Me.RecordsetClone
If varFractions Then
rst.FindFirst "FractionsID = " & FractionsList
ElseIf varUnitMeasure Then
rst.FindFirst "UnitMeasureID = " & UnitMeasureList
ElseIf varIngredient Then
rst.FindFirst "IngredientID = " & IngredientsList
ElseIf varPreparation Then
rst.FindFirst "PreparationID = " & PreparationList
End If
Me.Bookmark = rst.Bookmark
If varFractions Then
InsertionString = InsertionString & Fraction & " "
ElseIf varUnitMeasure Then
InsertionString = InsertionString & UnitMeasure & " "
ElseIf varIngredient Then
InsertionString = InsertionString & Ingredient & " "
ElseIf varPreparation Then
InsertionString = InsertionString & Preparation & " "
End If
End Sub
This works Ok but my difficulty is that although each table has only about 50 items, if you select the last item in the last table it takes at least 3 seconds to transfer the selection to the separate field. The more records you add the longer it takes.
If you add another table the the form's record source, the delay is such that the form 'hangs'.
The only reason for having the tables in the form's record source is that is the only way I can do a search using RecordsetClone.
Does anyone have another suggestion?