combo box lookups in datasheet VBA

oli82

Registered User.
Local time
Today, 10:24
Joined
Jan 10, 2008
Messages
54
I have a subform in datasheet view.

I would like it such that if I select 'Ratio' from column 'Analyte', in the column called 'Value' I get a drop down with high/medium/low. Then if I add another row adding 'Chemical A' say I can go ahead and add a value (without using a drop down list).

I have been able to do the first bit this using vba:

If Me.ANALYTE_ID = 5 Then
Me.SAMPLE_VALUE.RowSource = "SELECT Ratio_TYPE.ID, Ratio_TYPE.Ratio_TYPE FROM Ratio_TYPE ORDER BY Ratio_TYPE.Ratio_TYPE;"

Me.SAMPLE_VALUE.ColumnCount = 2
Me.SAMPLE_VALUE.ColumnWidths = "0;5"
Else
End If

The only problem with this is that when I go to add the next entry which is a different analyte say 'Chemical 1' I cannot change the rowsource back to null. Also all the other enties in the datasheet then go blank (because they have no associated lookup I suppose)

Any ideas would be greatly appreciated.

Cheers,

Oliver
 

Users who are viewing this thread

Back
Top Bottom