I have a very simple query about the correct syntax for defining the RowSource of a listbox (lstRequest) based on a combo box value in the same form (fRequest.cboAcademicYear)
The above works for me as it is. I got to this starting at: " WHERE IDAcademicYear = 1" (or 2 or 3, etc, being one of the IDs) which worked. What is confusing me is all the articles I've read state that the syntax to refer to the combo box (in red) should be:
strREQUEST = strREQUEST & " WHERE IDAcademicYear = " & Me.cboAcademicYear
That does not work for me. Why would that be? (Access 2013).
I also found Me.cboAcademicYear.Value didn't work.
Neither did Me.cboAcademicYear.Column(0). That should point to first column (hidden or not) shouldn't it, which is IDAcademicYear...
Isn't Me defining where to look in relation to current form?
I even tried fRequest!cboAcademicYear.Column(0) when Me wasn't working.... which didn't work.
Just curious if somecome could explain why (and why not) these do/don't work.... (and blindingly obvious probably) :banghead: I'd just like to learn why and not waste god-knows how much time over simple things.
Code:
[B]Private Sub FilterRequest()[/B]
Dim strREQUEST As String
strREQUEST = "SELECT qRequest.IDRequest, qRequest.AcademicYear, qRequest.RequestType, qRequest.Subject FROM qRequest"
strREQUEST = strREQUEST & " WHERE IDAcademicYear = "[COLOR=Red] & cboAcademicYear[/COLOR]
strREQUEST = strREQUEST & " ORDER BY qRequest.IDRequest;"
Me.lstRequest.RowSource = strREQUEST
Me.lstRequest.Requery
[B]End Sub[/B]
strREQUEST = strREQUEST & " WHERE IDAcademicYear = " & Me.cboAcademicYear
That does not work for me. Why would that be? (Access 2013).
I also found Me.cboAcademicYear.Value didn't work.
Neither did Me.cboAcademicYear.Column(0). That should point to first column (hidden or not) shouldn't it, which is IDAcademicYear...
Isn't Me defining where to look in relation to current form?
I even tried fRequest!cboAcademicYear.Column(0) when Me wasn't working.... which didn't work.
Just curious if somecome could explain why (and why not) these do/don't work.... (and blindingly obvious probably) :banghead: I'd just like to learn why and not waste god-knows how much time over simple things.