After Udate in a combobox

  • Thread starter Thread starter Randyfprf
  • Start date Start date
R

Randyfprf

I have aa cboClassroom bound to a Classroom subform.
I would like the subform to show the selection after I
make it and also would like the cboClassroom to stay
syncronized with the current record.
TYIA
Randy
 
Y're speaking about a Classroom subform ...
So the combo cboClassroom is on the masterform and
the yr subform Classroom needs to navigate to the corresponding
Classroom selection on parent form, right?

The below code is untested of course, but it will certainly
bring about some ideas you can adapt in yr situation.
below code assumes:
- there is a classroom primkey, called classroom_id
- boundcolumn of yr cboClassroom counters Classroom primkey

Private Sub cboclassroom_afterupdate()
Dim rs as dao.recordset
set rs = me.sfrmClassroom.Form.Recordsetclone
rs.findfirst "[classroom_id] = " & me.cboclassroom
If not rs.eof Then me.sfrmClassroom.form.bookmark = rs.bookmark
end sub

To ensure that cboClassroom on yr masterform stays syncronized with
selection in subform sfrmClassroom, enter following in the OnCurrent event
of the subform

private sub form_current()
me.parent.cboClassroom = me.classroom_id
end sub

Krgrds,
Perry
 
Some help ther, Thanks.
Got thecboClassroom to stay in sync with the subform, but
still will not show record selected in the subform till I
press F9.
I would like to fix that.
TYIA
Randy
-----Original Message-----
Y're speaking about a Classroom subform ...
So the combo cboClassroom is on the masterform and
the yr subform Classroom needs to navigate to the corresponding
Classroom selection on parent form, right?

The below code is untested of course, but it will certainly
bring about some ideas you can adapt in yr situation.
below code assumes:
- there is a classroom primkey, called classroom_id
- boundcolumn of yr cboClassroom counters Classroom primkey

Private Sub cboclassroom_afterupdate()
Dim rs as dao.recordset
set rs = me.sfrmClassroom.Form.Recordsetclone
rs.findfirst "[classroom_id] = " & me.cboclassroom
If not rs.eof Then me.sfrmClassroom.form.bookmark = rs.bookmark
end sub

To ensure that cboClassroom on yr masterform stays syncronized with
selection in subform sfrmClassroom, enter following in the OnCurrent event
of the subform

private sub form_current()
me.parent.cboClassroom = me.classroom_id
end sub

Krgrds,
Perry

"Randyfprf" <[email protected]> schreef in bericht
I have aa cboClassroom bound to a Classroom subform.
I would like the subform to show the selection after I
make it and also would like the cboClassroom to stay
syncronized with the current record.
TYIA
Randy


.
 
Replace this code
rs.bookmark

by

If not rs.eof Then
with me.sfrmClassroom.form
.bookmark = rs.Bookmark
.refresh
end with
End If

Krgrds,
Perry

Randyfprf said:
Some help ther, Thanks.
Got thecboClassroom to stay in sync with the subform, but
still will not show record selected in the subform till I
press F9.
I would like to fix that.
TYIA
Randy
-----Original Message-----
Y're speaking about a Classroom subform ...
So the combo cboClassroom is on the masterform and
the yr subform Classroom needs to navigate to the corresponding
Classroom selection on parent form, right?

The below code is untested of course, but it will certainly
bring about some ideas you can adapt in yr situation.
below code assumes:
- there is a classroom primkey, called classroom_id
- boundcolumn of yr cboClassroom counters Classroom primkey

Private Sub cboclassroom_afterupdate()
Dim rs as dao.recordset
set rs = me.sfrmClassroom.Form.Recordsetclone
rs.findfirst "[classroom_id] = " & me.cboclassroom
If not rs.eof Then me.sfrmClassroom.form.bookmark = rs.bookmark
end sub

To ensure that cboClassroom on yr masterform stays syncronized with
selection in subform sfrmClassroom, enter following in the OnCurrent event
of the subform

private sub form_current()
me.parent.cboClassroom = me.classroom_id
end sub

Krgrds,
Perry

"Randyfprf" <[email protected]> schreef in bericht
I have aa cboClassroom bound to a Classroom subform.
I would like the subform to show the selection after I
make it and also would like the cboClassroom to stay
syncronized with the current record.
TYIA
Randy


.
 
I still need to F9 to get the subform to show the
selection from the cboClassroom.
I really apreciate your help.

Here is what I have,

Private Sub CboClassroom_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.[Classroom subform].Form.RecordsetClone
rs.FindFirst "[Hotel ID] = " & Me.CboClassroom
If Not rs.EOF Then
With Me.[Classroom subform].Form
.Bookmark = rs.Bookmark
.Refresh
End With
End If

End Sub
-----Original Message-----
Replace this code
rs.bookmark

by

If not rs.eof Then
with me.sfrmClassroom.form
.bookmark = rs.Bookmark
.refresh
end with
End If

Krgrds,
Perry

"Randyfprf" <[email protected]> schreef in bericht
Some help ther, Thanks.
Got thecboClassroom to stay in sync with the subform, but
still will not show record selected in the subform till I
press F9.
I would like to fix that.
TYIA
Randy
-----Original Message-----
Y're speaking about a Classroom subform ...
So the combo cboClassroom is on the masterform and
the yr subform Classroom needs to navigate to the corresponding
Classroom selection on parent form, right?

The below code is untested of course, but it will certainly
bring about some ideas you can adapt in yr situation.
below code assumes:
- there is a classroom primkey, called classroom_id
- boundcolumn of yr cboClassroom counters Classroom primkey

Private Sub cboclassroom_afterupdate()
Dim rs as dao.recordset
set rs = me.sfrmClassroom.Form.Recordsetclone
rs.findfirst "[classroom_id] = " & me.cboclassroom
If not rs.eof Then me.sfrmClassroom.form.bookmark = rs.bookmark
end sub

To ensure that cboClassroom on yr masterform stays syncronized with
selection in subform sfrmClassroom, enter following in the OnCurrent event
of the subform

private sub form_current()
me.parent.cboClassroom = me.classroom_id
end sub

Krgrds,
Perry

"Randyfprf" <[email protected]>
schreef
in bericht
I have aa cboClassroom bound to a Classroom subform.
I would like the subform to show the selection after I
make it and also would like the cboClassroom to stay
syncronized with the current record.
TYIA
Randy


.


.
 
Back
Top