Hi All
I've done a search on historical posts and have not found a releveant thread. Apologies if there is one - my search criteria must be off.
I'm updating a combo box using the results of previous data - don't believe cascading boxes is the answer.
The code below works in the sense that the queries are correctly updated - when viewed in accessess query screen.
But...
1. The combo box is blank on the form it is embedded into
2. If you select on of the blank options it gives i.e., there are a few blank option lines, it locks the form up so that only the combo box responds (still blank). To reset the form you must close it from the access Database window (even the top right X icon does not respond).
The Row source of the combo box is set to be the query updated "xl_TEST" and the code is tiggered from the "on enter" event - although I have tried other events and they all give the same response.
Has anyone come across either of these issues before? Any help and advice would be appreciated - thanks in advance.
Scube
I've done a search on historical posts and have not found a releveant thread. Apologies if there is one - my search criteria must be off.
I'm updating a combo box using the results of previous data - don't believe cascading boxes is the answer.
The code below works in the sense that the queries are correctly updated - when viewed in accessess query screen.
But...
1. The combo box is blank on the form it is embedded into
2. If you select on of the blank options it gives i.e., there are a few blank option lines, it locks the form up so that only the combo box responds (still blank). To reset the form you must close it from the access Database window (even the top right X icon does not respond).
The Row source of the combo box is set to be the query updated "xl_TEST" and the code is tiggered from the "on enter" event - although I have tried other events and they all give the same response.
Has anyone come across either of these issues before? Any help and advice would be appreciated - thanks in advance.
Scube
Code:
Private Sub cbo_importance_Enter()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Dim strSQL1 As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qry_xl")
Set qdf1 = db.QueryDefs("xl_TEST")
' MsgBox "change!"
strSQL = "SELECT tbl_componentDefinition.critical " & _
"FROM tbl_componentDefinition " & _
"WHERE tbl_componentDefinition.ID_componentName=" & Me.ID_componentName.Value & " " & _
"ORDER BY tbl_componentDefinition.critical;"
Debug.Print strSQL
qdf.SQL = strSQL
Set qdf = Nothing
Set db = Nothing
strSQL1 = "SELECT tbl_importanceLevels.importanceDescription " & _
"FROM tbl_importanceLevels, qry_xl " & _
"WHERE (([qry_xl]![critical] = [tbl_importanceLevels]![Not allowed if Critical]))" & _
"ORDER BY tbl_importanceLevels.importanceDescription;"
Debug.Print strSQL1
qdf1.SQL = strSQL1
Set qdf1 = Nothing
Set db = Nothing
' DoCmd.OpenQuery "qry_xl"
' DoCmd.Close acForm, Me.name
Last edited: