Access 360 Continuous Form Setfocus on Specific Record
- #1
I have a Continuous Form with lots of field based on a complex query.
The User can Click on a number field in the form and a pop-up form opens, this form allows them to change the number. When they close the form i run code to requery the main form.
No worries there but.. the focus jumps back to the top left of the form so if the user has scrolled down a few pages, then makes a change the focus jumps.
I have tried refresh, repaint, requery etc etc.
I have the record number on the pop form. Can i requery the form then use the record number to set the focus of the continuous form back to the correct record?
Thanks
- #3
Is that DoCmd.FindRecord ?
- #5
Okay i have played with the find rs code but am getting an error message
"a macro Set to one of the feilds current propertys failed because of an error in a findRecord action argument"
I should also mention that the form in question is a sub form.
Im using-
Dim rs As String
rs = Me.RawMaterialID
DoCmd.RunCommand acCmdSaveRecord
[Forms]![mainform]![Customers].Requery
[Forms]![mainform]![Customers]![RawMaterialID].SetFocus
DoCmd.FindRecord rs
Any idea what the error means? Does it refer to a field setting on the me.rawmaterial feild?
- #6
Why are you requerying the continuous form? That is what is causing the focus to shift back to the first record in the "new" recordset. Requery reruns the query and creates a NEW recordset. If all you want to do is to save the current record, use:
DoCmd.RunCommand acCmdSaveRecord
- #7
The feild that is updated is a figure thats used in the calculation of several other fields on the form. The Requery is needed to re-run the query and update all the effected fields.
Its all Future finantical Calculations that take diffrent prices (averages, Highest, Lowest) etc. And i know you are thinking these should'nt be stored fields as there are calculated and they weren't, but the users want to be able to fudge the figures as they need to keep there books looking balanced so i have had to add extra feilds which can be edited and hence the problems now.
- #8
Ken Lay is probably not going to jail but the people who actually cooked the books probably will.
Let your users enter adjustment transactions keyed to their userID. At least there will be an audit trail.
- #9
I have that side of things covered, i just need to be able to requery the form and then refocus the view on the correct line of fields in the form. I have the ID number passed to the pop form so there must be some way of doing this?
Ken who? Have i missed some major news event?
- #10
arrrrr Enron guy!
is there anything google cant find
- #12
Im running it from the pop-up form. Should i be storing the raw ID before requery and then runnin the code using that ID to jump to the correct record?
- #14
Sorry Rich you lost me there, im guessing you are calling find on 2 forms or something??
I have
1 Main Form = (mainform)
1 sub form = (subform)
1 Pop-up form (popform)
And a bunch of fields on the SubForm, im guessing we can call RawID and another lets say raw2ID if we need 2.
So from the close event on the POP-Up form i call a requery in the subform of the main form. And then refocus it to the record i was just on before the requery. Then Close the pop-up form.
Or do i need to be closing the pop-up form , requerying the subform and refocusing it?
Sorry to be a pain begining to confuse myself.
- #15
No Worries i have got it working
I just created a function to call the Find Record rs from a text box on the subform that stores the rawid when the pop form is open and resets to null after the function runs.
Thanks for your help and comments Rich and Pat.
Just gotta work out how to get the pop up to pop up where i want based on the xy cords of the pointer and im laughing.
yinglingdessitheigh83.blogspot.com
Source: https://www.access-programmers.co.uk/forums/threads/continuous-forms-setfocus.69821/
0 Response to "Access 360 Continuous Form Setfocus on Specific Record"
Enregistrer un commentaire