C
Cyndi
I have 2 combo box -
Mare - based on a query that pulls marenumber from the stallionseason
table and mare name from the stallionmare table(mare name is not in
stallionseason only ID)
I want second combo box to go to stallionseason table and give me
choices of the years the mare was on the farm seasonyear is a field
in stallionseason table
Here is my code
Private Sub Mare_AfterUpdate()
strSQL = "SELECT SeasonYear FROM StallionSeasonTable" &
"WHERE MareID = "& Me.cboMare & " " &_
"ORDER BY SeasonYear"
With Me.cboSeasonYear
.RowSourceType = "Table/Query"
.RowSource = strsql
End With
End Sub
Private Sub SeasonYear_AfterUpdate()
Dim sSQL As String
'This Function sets the RowSource of cboSeasonYear, based on the
'value selected in cboSeasonYear.
sSQL = "Select MareNumber,SeasonYear"_
& "FROM tblStallionSeason Table WHERE MareNumber =
"&Me.cboSeasonYear
& "ORDER BY SeasonYear"
Me.cboSeasonYear.RowSource = sSQL
'The combo should requery on it's own, but if it doesn't,
'uncomment the next line.
'Me.cboCombo2.Requery 'Requery the Combo
End Sub
Access does not like most of this the both places I have str or sql
are all red - and if you tell me I am missing the _ from the end of
the row access doesnt like when I put this in at all.
Thanks in advance
Mare - based on a query that pulls marenumber from the stallionseason
table and mare name from the stallionmare table(mare name is not in
stallionseason only ID)
I want second combo box to go to stallionseason table and give me
choices of the years the mare was on the farm seasonyear is a field
in stallionseason table
Here is my code
Private Sub Mare_AfterUpdate()
strSQL = "SELECT SeasonYear FROM StallionSeasonTable" &
"WHERE MareID = "& Me.cboMare & " " &_
"ORDER BY SeasonYear"
With Me.cboSeasonYear
.RowSourceType = "Table/Query"
.RowSource = strsql
End With
End Sub
Private Sub SeasonYear_AfterUpdate()
Dim sSQL As String
'This Function sets the RowSource of cboSeasonYear, based on the
'value selected in cboSeasonYear.
sSQL = "Select MareNumber,SeasonYear"_
& "FROM tblStallionSeason Table WHERE MareNumber =
"&Me.cboSeasonYear
& "ORDER BY SeasonYear"
Me.cboSeasonYear.RowSource = sSQL
'The combo should requery on it's own, but if it doesn't,
'uncomment the next line.
'Me.cboCombo2.Requery 'Requery the Combo
End Sub
Access does not like most of this the both places I have str or sql
are all red - and if you tell me I am missing the _ from the end of
the row access doesnt like when I put this in at all.
Thanks in advance