K
Kelvin Leong
I have a table named Case with columns CaseID, CaseDate, and Vehicle where
CaseID is the primary key. It is possible to have multiple cases for the same
vehicle as illustrated below:
CaseID | CaseDate | Vehicle
-------------------------------------
Case01 | 01/01/2007 | Vehicle01
Case02 | 02/01/2007 | Vehicle02
Case03 | 03/01/2007 | Vehicle01
I have created a form with a combo box (named VehicleSearch). This combo box
lists the values using the following statement:
SELECT DISTINCT Case.Vehicle FROM [Case] ORDER BY Case.Vehicle;
Upon choosing the Vehicle, the combo will run the following code:
With VehicleSearch
If .ListIndex <> -1 Then
sVehicleNo = .SelText
'Retrieves the value of the bound column which may more may not be
'displayed in the list box
sVehicleNo = .Column(.BoundColumn - 1)
Filter = "VehicleNo=" & sVehicleNo
FilterOn = True
MsgBox "Filter Applied"
End If
End With
This form is supposed to list the records (configured to display as
Continuous Form), based on the value filtered in the combo box.
The problem that I faced is that when I have chosen the Vehicle that I
wanted, there is a pop-up box that will require me to key-in the same Vehicle
again and click on OK. If not, the form will not filter the records based on
the Vehicle.
Is it possible to change it so that I just need to choose from the combo box
and not need to re-key-in the Vehicle again?
Thanks.
Best regards,
Kelvin
CaseID is the primary key. It is possible to have multiple cases for the same
vehicle as illustrated below:
CaseID | CaseDate | Vehicle
-------------------------------------
Case01 | 01/01/2007 | Vehicle01
Case02 | 02/01/2007 | Vehicle02
Case03 | 03/01/2007 | Vehicle01
I have created a form with a combo box (named VehicleSearch). This combo box
lists the values using the following statement:
SELECT DISTINCT Case.Vehicle FROM [Case] ORDER BY Case.Vehicle;
Upon choosing the Vehicle, the combo will run the following code:
With VehicleSearch
If .ListIndex <> -1 Then
sVehicleNo = .SelText
'Retrieves the value of the bound column which may more may not be
'displayed in the list box
sVehicleNo = .Column(.BoundColumn - 1)
Filter = "VehicleNo=" & sVehicleNo
FilterOn = True
MsgBox "Filter Applied"
End If
End With
This form is supposed to list the records (configured to display as
Continuous Form), based on the value filtered in the combo box.
The problem that I faced is that when I have chosen the Vehicle that I
wanted, there is a pop-up box that will require me to key-in the same Vehicle
again and click on OK. If not, the form will not filter the records based on
the Vehicle.
Is it possible to change it so that I just need to choose from the combo box
and not need to re-key-in the Vehicle again?
Thanks.
Best regards,
Kelvin