Hi everyone,
i have 2 combobox on a form that gets their values from 2 different tables.
The first combobox (Cbo1) as the following select statement:
SELECT Tbl_Crops.Crop_nameFROM Tbl_Crops
ORDER BY Tbl_Crops.Crop_name;
The second combobox (Cbo2) has the following:
SELECT Tbl_AFRCountries.CountryName
FROM Tbl_AFRCountries
ORDER BY Tbl_AFRCountries.CountryName;
These combo boxes acts as a search boxes (a user can select a value from Cbo1 and press a "Search Button" to filter the records / OR can select a value from Cbo2 and press a "Search Button" to filter the records / OR can select values from Cbo1 and Cbo2 and then press a "Search Button" to filter the records ).
In the OnClick Event of the "Search Button" i have the following code:
Private Sub BT_Search_Click()
DoCmd.OpenForm "Frm_AppRateList", acNormal, , "Crop_Name Like '" & Me.Cbo1 & "*' AND CountryName Like '" & Me.Cbo2 & "*'"
End Sub
Now because i had some space issue on my form, i had to get rid of the combobox label.
And now i want Cbo1 to display "Select Crop" and Cbo2 to display "Select Country" as the default values when the user opens the form.
What i did at first, was setting the default values for both combox boxes in the Property sheet.
However when i select a value from Cbo1 and press the "Search Button" to filter the record, it returns nothing meanwhile it has to return something.
I came to realize that it was because the search code also takes into account the already set default value of Cbo2 and assume that it is a search criteria.
Can anyone help me with this issue?