J
Jez
I have a sub form on my form and on that there is a ComboBox, when the
ComboBox is activated the GotFocus is applied, I am trying to be able to have
the options to choose in my ComboxBox selectable.
Am not sure I have explained it very well, but here is my code, any
questions please ask and will try explain
Private Sub cboResponse_GotFocus()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sQRY As String
'On Error GoTo Err
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
intResponseID = Me.Recordset
'intResponseID = Me.ResponseID
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;User Id=Admin; " & _
"Data Source=" & cTables
With Me.cboResponse
.RowSource = _
"SELECT tblCSATResponseType.ResponseItem " & _
"FROM tblCSATResponseType " & _
"WHERE tblCSATResponseType.ResponseID = " & intResponseID
rs.CursorLocation = adUseClient
rs.Open sQRY, cnn, adOpenForwardOnly, adLockOptimistic
End With
End Sub
As on this code I have intResponseID = Me.Recordset then when the main form
opens it shows the record in one line, I dont understand why, because this
section is a set of questions and there are 5 in the table.
If I use this line which I thought might work intResponseID = Me.ResponseID
I get an error on load of main form.
Jez
ComboBox is activated the GotFocus is applied, I am trying to be able to have
the options to choose in my ComboxBox selectable.
Am not sure I have explained it very well, but here is my code, any
questions please ask and will try explain
Private Sub cboResponse_GotFocus()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sQRY As String
'On Error GoTo Err
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
intResponseID = Me.Recordset
'intResponseID = Me.ResponseID
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;User Id=Admin; " & _
"Data Source=" & cTables
With Me.cboResponse
.RowSource = _
"SELECT tblCSATResponseType.ResponseItem " & _
"FROM tblCSATResponseType " & _
"WHERE tblCSATResponseType.ResponseID = " & intResponseID
rs.CursorLocation = adUseClient
rs.Open sQRY, cnn, adOpenForwardOnly, adLockOptimistic
End With
End Sub
As on this code I have intResponseID = Me.Recordset then when the main form
opens it shows the record in one line, I dont understand why, because this
section is a set of questions and there are 5 in the table.
If I use this line which I thought might work intResponseID = Me.ResponseID
I get an error on load of main form.
Jez