G
Guest
what about:
docmd.GoToRecord acActiveDataObject,,acFirst
docmd.GoToRecord acActiveDataObject,,acFirst
Naeem said:what about:
docmd.GoToRecord acActiveDataObject,,acFirst
Peter Stone said:I have a form: frmText based on tblText
On the form is Combo320 in which I select and display destinations from a
child table: tblDestinations using the following query.
SELECT tblDestinations.DestinationsID, tblDestinations.Destination,
tblDestinations.DestinationType, tblDestinations.Publish FROM tblDestinations
ORDER BY tblDestinations.Destination;
On the After Update property of Combo320, I have the following Event
Procedure:
Private Sub Combo320_AfterUpdate()
Me.Requery
Forms!frmText.Refresh
End Sub
I then have a list box that displays all the record headings from the
selected destination:
SELECT tblText.TextID, tblText.DestinationsID, tblText.Heading FROM tblText
WHERE (((tblText.DestinationsID)=Forms!frmText!Combo320));
Everything works fine, except when I select a new destination with Combo320.
It displays the selected child record on the subform, but doesn’t go to the
joined master record in tblText—thereby modifying the record.
I need to move to the first record for the selected destination.
I tried putting the following into Private Sub Combo320_AfterUpdate() but no
joy.
Me.RecordsetClone.FindFirst "[DestinationsID] = " & Me![Combo320]
Me.Bookmark = Me.RecordsetClone.Bookmark
Help please!
Thank you
Peter
Peter said:I have a form: frmText based on tblText
On the form is Combo320 in which I select and display destinations from a
child table: tblDestinations using the following query.
SELECT tblDestinations.DestinationsID, tblDestinations.Destination,
tblDestinations.DestinationType, tblDestinations.Publish FROM tblDestinations
ORDER BY tblDestinations.Destination;
On the After Update property of Combo320, I have the following Event
Procedure:
Private Sub Combo320_AfterUpdate()
Me.Requery
Forms!frmText.Refresh
End Sub
I then have a list box that displays all the record headings from the
selected destination:
SELECT tblText.TextID, tblText.DestinationsID, tblText.Heading FROM tblText
WHERE (((tblText.DestinationsID)=Forms!frmText!Combo320));
Everything works fine, except when I select a new destination with Combo320.
It displays the selected child record on the subform, but doesn’t go to the
joined master record in tblText—thereby modifying the record.
I need to move to the first record for the selected destination.
I tried putting the following into Private Sub Combo320_AfterUpdate() but no
joy.
Me.RecordsetClone.FindFirst "[DestinationsID] = " & Me![Combo320]
Me.Bookmark = Me.RecordsetClone.Bookmark
Marshall Barton said:Peter said:I have a form: frmText based on tblText
On the form is Combo320 in which I select and display destinations from a
child table: tblDestinations using the following query.
SELECT tblDestinations.DestinationsID, tblDestinations.Destination,
tblDestinations.DestinationType, tblDestinations.Publish FROM tblDestinations
ORDER BY tblDestinations.Destination;
On the After Update property of Combo320, I have the following Event
Procedure:
Private Sub Combo320_AfterUpdate()
Me.Requery
Forms!frmText.Refresh
End Sub
I then have a list box that displays all the record headings from the
selected destination:
SELECT tblText.TextID, tblText.DestinationsID, tblText.Heading FROM tblText
WHERE (((tblText.DestinationsID)=Forms!frmText!Combo320));
Everything works fine, except when I select a new destination with Combo320.
It displays the selected child record on the subform, but doesn’t go to the
joined master record in tblText—thereby modifying the record.
I need to move to the first record for the selected destination.
I tried putting the following into Private Sub Combo320_AfterUpdate() but no
joy.
Me.RecordsetClone.FindFirst "[DestinationsID] = " & Me![Combo320]
Me.Bookmark = Me.RecordsetClone.Bookmark
You should not be requerying the form, just the list box.
After doing a rquery, the refresh is redundant and won't
accomplish anything.
It's not clear to me if the record navigation you're try to
do should be moving the main form's or the subform's current
record. For the main form, your code is ok, unless
combo320's BoundColumn is not 1 or the DestinationID is a
text field.
Private Sub Combo320_AfterUpdate()
Me.thelistbox.Requery
Me.RecordsetClone.FindFirst _
"[DestinationsID] = " & Me![Combo320]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Because you are moving to a record, the combo320 control
should not be bound to a field in the table. Double check
that its ControlSource property is empty.