Hi all,
please have a look on the attached screen shot!
By changing the selection in the combo box I'll get run time error '3464': "Data type mismatch in criteria expression."
The idea is:
1. The user selects a strategy name (e. g. dfgsdfgfdsg) from the combo box.
2. A marco reads out the according Strategies.ID from Strategies.
3. Based on this ID the according Keyords will be read from Strategy.
4. I want to populate the text box in the detail section with the entries of the Variant-Array created in step 3.
Here is my code:
Private Sub Strategy_CoBo_Change()
Dim SQL As String
Dim StrategiesID As Integer
'Dim StratKW As Variant
'Dim i
SQL = "SELECT ID FROM Strategies where Name=" & Chr(34) & Me.Strategy_CoBo.Value & Chr(34)
StrategiesID = DBREAD(SQL)(0) 'Integer indentifies the Strategy
'SQL = "SELECT Keyword FROM Strategy where ID=" & StrategiesID & " Order by Keyword"
'StratKW = DBREAD(SQL)
'Me.DetailKeyword.Value = StratKW(0)
Me.DetailKeyword.Value = DLookup("[Keyword]", "Strategy", "[ID] = '" & Me.Strategy_CoBo.Value & "'")
'For i = LBound(StratKW) To UBound(StratKW)
' Me!Detail.Form.DetailKeyword = StratKW(i)
'Next i
End Sub
What I am doing wrong?
Thank you very much,
Lloyd
Bookmarks