Coding to populate a drop down list

JQasd

Registered User.
Local time
Today, 17:44
Joined
Jun 21, 2016
Messages
35
Eliminate repitition in a drop down list

Hi there,

I have a main table that has various metals with specific metal codes.For example there is a material column such as titanium aluminium etc.And when metals are selected in my drop down list I want another drop down list to populate all the metals list. However, there is a repetition in my drop down list as for titanium there are various metal codes available such as Ti-64, Ti-10.2.3 etc.

To resolve this problem I have made another table and applied the following coding.

Private Sub cbo_matCat_AfterUpdate()
Dim matStr As String


matStr = "SELECT [TCategory].[Material] FROM [TCategory] WHERE ([Category] = '" & Me.cbo_matCat & "')ORDER BY [Material] ASC"

Me.cbo_mat.RowSource = matStr
Me.cbo_mat.Requery
End Sub

Is there any way I could do this using he main table and eliminating repetition through the coding.

Thanks
 
Last edited:
use Distinct keyword on your SQL:

Select Distinct [Material] From [TCategory];"
 
use Distinct keyword on your SQL:

Select Distinct [Material] From [TCategory];"

Thanks a lot. You have helped me a lot in this database development. be blessed.

Can you tell me one thing more please. All these materials have certain properties saved in excel sheets and I export it using the Access interface.Is there any way in the main table I can add that mechanical property for ti-64, hot compression is available so only show that and other are not available.I have attached a screen shot of my interface to give you idea. At the moment my property and data type drop down boxes are not dependant on other combo boxes.

thanks again
 

Attachments

  • Capture11.JPG
    Capture11.JPG
    26 KB · Views: 69

Users who are viewing this thread

Back
Top Bottom