By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,122 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,122 IT Pros & Developers. It's quick & easy.

Updating a forms underlying recordset.

P: n/a
Hi all,

I have a bound displaying a product, and other details, and a couple of
subforms displaying order details for that product.
A combo is used to navigate to a selected product, and the form displays the
product and order details. So far so good.
I also have an update button on the main which allows me to add/modify
product details, by opening another form.

On the activate event of the form, I update the list box, so any
new/modified products get added to the listbox, allowing me to select this
new product when I get back to the main form. .Again works fine, and the new
product is immediately on the list.
However when I now select this new product, to display details on the main
form, it refuses to do it. I can select any of the other previously entered
products, but not the new one. The details just stay the same as they were
for the most recent product selection from the list, which is not the new
one.
It seems to me that although i've updated the new product to the
recordsource of the listbox,
somehow, i've not done it for the Form, before I've called the search.

Any clues most welcome.
Gerry Abbott


Here is the code i'm using to find the record from the bound form.
----------------------------------------------------------------------------
-
Private Sub ProdSearch_Click()

If Not IsNull(Me.ProdSearch) Then
With Me.RecordsetClone
.FindFirst "partId=" & Me.ProdSearch

If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End If

Me.frmIssued.SetFocus
DoCmd.GoToRecord , , acLast
Me.frmOrders.SetFocus
DoCmd.GoToRecord , , acLast
Me.frmOrders.Requery
Me.frmIssued.Requery
Me.ProdSearch = Null
End Sub
----------------------------------------------------------------------------
-----

And here's the code im using to update the form, when a new record has been
added to the product list.

Private Sub Form_Activate()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 '
not sure why i'm using this?
Me![frmOrders].Requery ' this is the subform.
Me![ProdSearch].Requery
Me.Refresh

End Sub



Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> I have a bound displaying a product, and other details, and a couple of
subforms displaying order details for that product.
A combo is used to navigate to a selected product, and the form displays the
product and order details. So far so good.
I also have an update button on the main which allows me to add/modify
product details, by opening another form.

On the activate event of the form, I update the list box, so any
new/modified products get added to the listbox, allowing me to select this
new product when I get back to the main form. .Again works fine, and the new
product is immediately on the list.
However when I now select this new product, to display details on the main
form, it refuses to do it. I can select any of the other previously entered
products, but not the new one. The details just stay the same as they were
for the most recent product selection from the list, which is not the new
one.


You need to requery the form, also, or the new item won't appear in the form's
recordset:

Me.Requery

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2

P: n/a
Bullseye!
Many thanks,
"Bruce M. Thompson" <bthmpson@big_NOSPAM_foot.com> wrote in message
news:vm************@corp.supernews.com...
I have a bound displaying a product, and other details, and a couple of
subforms displaying order details for that product.
A combo is used to navigate to a selected product, and the form displays the
product and order details. So far so good.
I also have an update button on the main which allows me to add/modify
product details, by opening another form.

On the activate event of the form, I update the list box, so any
new/modified products get added to the listbox, allowing me to select this new product when I get back to the main form. .Again works fine, and the new product is immediately on the list.
However when I now select this new product, to display details on the main form, it refuses to do it. I can select any of the other previously entered products, but not the new one. The details just stay the same as they were for the most recent product selection from the list, which is not the new one.
You need to requery the form, also, or the new item won't appear in the

form's recordset:

Me.Requery

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access) NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.