S
S Jackson
On my form, I have a combo box that looks up Region from a table. In the
Afterupdate event of this combo box, I have the following code:
'Code for Program Manager Information
Dim strSQL as String
strSQL = "Select tblSurveyors.SurveyorID, tblSurveyors.SvyCity, " _
& "tblSurveyors.SvyFirstName, tblSurveyors.SvyLastName, " _
& "tblSurveyors.SvyTitle, tblSurveyors.Region, tblSurveyors.SvyPhone " _
& "FROM tblSurveyors " _
& "WHERE tblSurveyors.Region = " & Me.Region & " " _
& "AND tblSurveyors.SvyTitle LIKE " & "'" & "Program*" & "' " _
& "ORDER BY tblSurveyors.svyLastName;"
Me.cmbFieldOfc.RowSource = strSQL
MsgBox strSQL
The above code provides the data for the 2nd combo box, cmbFieldofc which is
bound to the Fieldofc field in table tblCaseInfo. The two text boxes are
setup like so:
=[cmbFieldofc].Column(3)
=[cmbFieldofc].Column(6)
The problem I am having is that when I input the information for the first
time, everything works great. However, when I move to a new record and then
go back, the information is not correct - the 2nd combo box reverts to its
original query information, which messes up the two txt boxes.
So, the question is, what event on which control do I need to add code to?
Is it an event on the Form? If so, I may have a problem as I already
declared "strSQL as String" for a different process on the OnCurrent and
AfterUpdate events on the form control. So, if I have to add the above code
for the two combo boxes, do I just give it a different name (strSQL2)?
Any help is greatly appreciated. I always get lost with regard to which
event to assign code!
TIA
Afterupdate event of this combo box, I have the following code:
'Code for Program Manager Information
Dim strSQL as String
strSQL = "Select tblSurveyors.SurveyorID, tblSurveyors.SvyCity, " _
& "tblSurveyors.SvyFirstName, tblSurveyors.SvyLastName, " _
& "tblSurveyors.SvyTitle, tblSurveyors.Region, tblSurveyors.SvyPhone " _
& "FROM tblSurveyors " _
& "WHERE tblSurveyors.Region = " & Me.Region & " " _
& "AND tblSurveyors.SvyTitle LIKE " & "'" & "Program*" & "' " _
& "ORDER BY tblSurveyors.svyLastName;"
Me.cmbFieldOfc.RowSource = strSQL
MsgBox strSQL
The above code provides the data for the 2nd combo box, cmbFieldofc which is
bound to the Fieldofc field in table tblCaseInfo. The two text boxes are
setup like so:
=[cmbFieldofc].Column(3)
=[cmbFieldofc].Column(6)
The problem I am having is that when I input the information for the first
time, everything works great. However, when I move to a new record and then
go back, the information is not correct - the 2nd combo box reverts to its
original query information, which messes up the two txt boxes.
So, the question is, what event on which control do I need to add code to?
Is it an event on the Form? If so, I may have a problem as I already
declared "strSQL as String" for a different process on the OnCurrent and
AfterUpdate events on the form control. So, if I have to add the above code
for the two combo boxes, do I just give it a different name (strSQL2)?
Any help is greatly appreciated. I always get lost with regard to which
event to assign code!
TIA