Bluezman
05-15-2002, 08:09 AM
I'm trying to correctly code 3 combo boxes, using the VB below. (cboBody is working correctly sets the correct rowsource for cboNumber. cboBody gets its contents from a table listing Organization numbers.)
Private Sub cboBody_AfterUpdate()
Me![cboNumber].RowSource = "SELECT BodyNumber FROM" & _
" ActiveBodies WHERE [BodyType] = " & Me.cboBody & _
" ORDER BY BodyNumber"
Me![cboBody].Requery
End Sub
(Body types are 1, 2 or 3)
Private Sub cboNumber_AfterUpdate()
Me![cboName].RowSource = "SELECT mbrID, [Last Name], Suffix, [First Name], [Middle Name] FROM" & _
" MemberFormQuery WHERE [Chapter Number] = " & Me.cboNumber & _
" ORDER BY mbrID"
Me![cboName].Requery
End Sub
Private Sub cboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[mbrID] = " & Str(Nz(Me![cboName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me![cboName] = ""
Me![cboName].Requery
Me![cboNumber] = ""
Me![cboNumber].Requery
Me![cboBody] = ""
Me![cboBody].Requery
End Sub
Is it possible for cboNumber to change the WHERE criteria (using IF statements) based on which BodyType was selected in cboBody? For example, if BodyType 1 was selected in cboBody, cboNumbers WHERE criteria would be the field [Chapter Number], but if BodyType 2 was selected, cboNumbers WHERE criteria would be changed to [Council Number]?
If you need more info, please let me know.
Thanks in advance!!
Bluez
Private Sub cboBody_AfterUpdate()
Me![cboNumber].RowSource = "SELECT BodyNumber FROM" & _
" ActiveBodies WHERE [BodyType] = " & Me.cboBody & _
" ORDER BY BodyNumber"
Me![cboBody].Requery
End Sub
(Body types are 1, 2 or 3)
Private Sub cboNumber_AfterUpdate()
Me![cboName].RowSource = "SELECT mbrID, [Last Name], Suffix, [First Name], [Middle Name] FROM" & _
" MemberFormQuery WHERE [Chapter Number] = " & Me.cboNumber & _
" ORDER BY mbrID"
Me![cboName].Requery
End Sub
Private Sub cboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[mbrID] = " & Str(Nz(Me![cboName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me![cboName] = ""
Me![cboName].Requery
Me![cboNumber] = ""
Me![cboNumber].Requery
Me![cboBody] = ""
Me![cboBody].Requery
End Sub
Is it possible for cboNumber to change the WHERE criteria (using IF statements) based on which BodyType was selected in cboBody? For example, if BodyType 1 was selected in cboBody, cboNumbers WHERE criteria would be the field [Chapter Number], but if BodyType 2 was selected, cboNumbers WHERE criteria would be changed to [Council Number]?
If you need more info, please let me know.
Thanks in advance!!
Bluez