combo box not updating accoring to record selector

G

Guest

Hello all,

I have a combo box which i use as a search field.
Correct me if i am wrong. Using the code below i am able to select the
record from the combo box and it populates the corresponding values to all
other controls on the form and subform. When i use the default record select
and scroll from one record to another the combo box selection remains in the
last selected value. Can i code to make the combo box record value highlight
the value I have scrolled.


long story short when i select a record using the default record locater the
main form footer section i need it to display the selected value on all
controls including the combo box
Sub CboMoveTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.cboMoveTo
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks in advance , i really would appreciate if someone could help me on
this.
 
C

Carl Rapson

vandy said:
Hello all,

I have a combo box which i use as a search field.
Correct me if i am wrong. Using the code below i am able to select the
record from the combo box and it populates the corresponding values to all
other controls on the form and subform. When i use the default record
select
and scroll from one record to another the combo box selection remains in
the
last selected value. Can i code to make the combo box record value
highlight
the value I have scrolled.


long story short when i select a record using the default record locater
the
main form footer section i need it to display the selected value on all
controls including the combo box
Sub CboMoveTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.cboMoveTo
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks in advance , i really would appreciate if someone could help me on
this.

In the form's Current event, set the combo box to the new current value:

Me.cboMoveTo = Me.[Customer ID]

Carl Rapson
 
G

Guest

thanks a ton. it worked like a charm!!

Carl Rapson said:
vandy said:
Hello all,

I have a combo box which i use as a search field.
Correct me if i am wrong. Using the code below i am able to select the
record from the combo box and it populates the corresponding values to all
other controls on the form and subform. When i use the default record
select
and scroll from one record to another the combo box selection remains in
the
last selected value. Can i code to make the combo box record value
highlight
the value I have scrolled.


long story short when i select a record using the default record locater
the
main form footer section i need it to display the selected value on all
controls including the combo box
Sub CboMoveTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.cboMoveTo
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks in advance , i really would appreciate if someone could help me on
this.

In the form's Current event, set the combo box to the new current value:

Me.cboMoveTo = Me.[Customer ID]

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top