Combo box not updating fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've done this before but I can never remember the order in which this is
done and I can't find my notes from the last successful mission:

Goal: Take one column of data from table and create drop down list that
automatically populates other fields with data. That part I can do, however,
when I use the arrows down on the bottom of the screen to go back and forth
between records, the populated fields change but the data in the combo box
stays the same and does not reflect the correct data from the previous or
next record.
 
Sounds like you are using an unbound combo to find the records in the form?

If so, the simplest solution is to set the combo to Null as soon as you find
the record, i.e. add the line:
Me.[Combo1] = Null
using your combo's name instead of Combo1.

If that's not what you want, you will need to use the Current event of the
form to assign a value to the unbound combo, presumably on the basis of
another control in the form. You may need need to use the AfterUpdate event
of that control as well, so it stays up to date if the dependent control
changes.
 
Hi Allen,

The code I have in another database that works is pasted below. I
replicated this in the new database but can't get it to work. Last time I
had this problem I wrote down the serious of instructions I finally found
worked - however, as fate would have it I can't find those notes. I can't
remember if I changed a text box into a combo box and then built the code or
if I did a combo box using wizard. Either way, there are multiple paths I
can take doing either and I can't remeber the stupid steps!

Private Sub Combo177_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Brochure] = '" & Me![Combo177] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Combo177_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Form_Current()
Combo177 = Brochure
End Sub

Allen Browne said:
Sounds like you are using an unbound combo to find the records in the form?

If so, the simplest solution is to set the combo to Null as soon as you find
the record, i.e. add the line:
Me.[Combo1] = Null
using your combo's name instead of Combo1.

If that's not what you want, you will need to use the Current event of the
form to assign a value to the unbound combo, presumably on the basis of
another control in the form. You may need need to use the AfterUpdate event
of that control as well, so it stays up to date if the dependent control
changes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

natalie said:
I've done this before but I can never remember the order in which this is
done and I can't find my notes from the last successful mission:

Goal: Take one column of data from table and create drop down list that
automatically populates other fields with data. That part I can do,
however,
when I use the arrows down on the bottom of the screen to go back and
forth
between records, the populated fields change but the data in the combo box
stays the same and does not reflect the correct data from the previous or
next record.
 
Yes the previous reply should apply.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

natalie said:
Hi Allen,

The code I have in another database that works is pasted below. I
replicated this in the new database but can't get it to work. Last time I
had this problem I wrote down the serious of instructions I finally found
worked - however, as fate would have it I can't find those notes. I can't
remember if I changed a text box into a combo box and then built the code
or
if I did a combo box using wizard. Either way, there are multiple paths I
can take doing either and I can't remeber the stupid steps!

Private Sub Combo177_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Brochure] = '" & Me![Combo177] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Combo177_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Form_Current()
Combo177 = Brochure
End Sub

Allen Browne said:
Sounds like you are using an unbound combo to find the records in the
form?

If so, the simplest solution is to set the combo to Null as soon as you
find
the record, i.e. add the line:
Me.[Combo1] = Null
using your combo's name instead of Combo1.

If that's not what you want, you will need to use the Current event of
the
form to assign a value to the unbound combo, presumably on the basis of
another control in the form. You may need need to use the AfterUpdate
event
of that control as well, so it stays up to date if the dependent control
changes.

natalie said:
I've done this before but I can never remember the order in which this
is
done and I can't find my notes from the last successful mission:

Goal: Take one column of data from table and create drop down list that
automatically populates other fields with data. That part I can do,
however,
when I use the arrows down on the bottom of the screen to go back and
forth
between records, the populated fields change but the data in the combo
box
stays the same and does not reflect the correct data from the previous
or
next record.
 
Back
Top