requery

J

Junior

Using the code below to requery after a tbx is updated
But the form moves to the first record after update the tbx - how can i keep
the form on the current record?

Private Sub txtAuthCeil_AfterUpdate()
On Error GoTo Err_HandleErr_Click
Me.Requery
Me.lbxSvc.Requery
Exit_HandleErr_Click:
Exit Sub

Err_HandleErr_Click:
MsgBox Error$
Resume Exit_HandleErr_Click
End Sub
 
M

MacDermott

Me.Requery will always move to the first record.
Do you really need to requery the form?
Perhaps just requerying lbxSvc would suffice.
 
J

Junior

Thanks Mac - but only requerying lbxSvc doesn't seem to update anything- i
also tried bookmark but got an invalid bookmark error
 
J

Junior

this should be so simple - but i'm brain dead at this point
i have a form the is used to update records in a table - (a service table
for an employee tracking program)
whenever the authorized ceiling field (txtAuthCeil) is changed - i want it
to immediately update the table and to
reflect the change in a txtbox (lbxSvc) that displays the list of service
ceilings
the problem is when the form is requeried it reverts to the first record - i
want the form to remain on the current record-i.e. the one that was just
updated

thanks for any help
 
R

Rick Brandt

Junior said:
this should be so simple - but i'm brain dead at this point
i have a form the is used to update records in a table - (a service
table for an employee tracking program)
whenever the authorized ceiling field (txtAuthCeil) is changed - i
want it to immediately update the table and to
reflect the change in a txtbox (lbxSvc) that displays the list of
service ceilings
the problem is when the form is requeried it reverts to the first
record - i want the form to remain on the current record-i.e. the one
that was just updated

How exactly is a TextBox displaying a "list"? Have you tried just requerying
the control instead of the form? You can use code to save the Primary Key of
the current record in a variable, Requery the form, and then use that varaible
value to navigate back to the record you were on originally, but this sounds
like a really bad way to accomplish what you are doing.

Is the user even finished editing the record at the point of the requery? If
not, doing a Requery is simply not a good thing to be doing.
 
J

Junior

Rick - i misspoke - it is actually a list box -i've tried requerying the cbo
box and list box but doesn't reflect the new data
no- the user might not be finished updating the record
I was just trying to improve the existing form - but maybe i should leave it
alone since it works - it just doesn't display the updated info until the
form is closed.
thanks for the help and advice
 

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