Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get the row I updated through Form?

Status
Not open for further replies.

740929

Programmer
Jan 5, 2003
2
0
0
US
I ues form to display data.If I update some data in form, how can I get/display the row I updated only?

For example:(form frmOrders)
ID NAME QTY ........
1 aa 0 ........
2 bb 0 ........
3 cc 0 ........
There is a button.

if I change ID2's QTY to 4, then click the button.
How can I get a report/form that only show ID2's information(2, bb, 4)?
 
Hi

Not Sure I understand your problem?:

Unless you have moved (via navigation buttons or some such means)off the record where you updated the QTY, then that record will still be the current record

but, for what it is worth the bookmark .LastModified should as its name implies position you on the last modified row eg something like

Me.BookMark = Me.LastModified

If you want to do this ONLY when the QTY column is updated, then in the AfterUpdate event of the QTY save the bookmark to a formwide variable and reposition in the onclick event of the button

ie in the AfterUpdate Event

MyBookMark = Me.Bookmark

in the OnClick event of the button
Me.Bookmark = MyBookMark Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I think you can build a report or form built on a query selecting the ID of the current record and assign it to the button.
Try it!
 
Hi

On reading you post again, a couple of other points come to mind:

The underlying table is not updated until you navigate off the row, OR explicitly save it, so if what you are trying to do is produce a report for the single row you have updated, by clicking on a button on the form, you need to execute a save row BEFORE calling the report eg something like

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport ...etc

Within the DoCmd.OpenReport syntax, you can set a where condition (without the word WHERE), top make it print only selected rows, in you example ID would appear to be the unique key, so your condition would be something like

"Id = " & Me.Id

See Bookmark, DoCmd.RunCommand, DoCmd.OpenReport in help, and I am sure all will be clear Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top